Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * ioctl interface for the scsi media changer driver
0004  */
0005 
0006 #ifndef _UAPI_LINUX_CHIO_H
0007 #define _UAPI_LINUX_CHIO_H
0008 
0009 /* changer element types */
0010 #define CHET_MT   0 /* media transport element (robot) */
0011 #define CHET_ST   1 /* storage element (media slots) */
0012 #define CHET_IE   2 /* import/export element */
0013 #define CHET_DT   3 /* data transfer element (tape/cdrom/whatever) */
0014 #define CHET_V1   4 /* vendor specific #1 */
0015 #define CHET_V2   5 /* vendor specific #2 */
0016 #define CHET_V3   6 /* vendor specific #3 */
0017 #define CHET_V4   7 /* vendor specific #4 */
0018 
0019 
0020 /*
0021  * CHIOGPARAMS
0022  *    query changer properties
0023  *
0024  * CHIOVGPARAMS
0025  *    query vendor-specific element types
0026  *
0027  *    accessing elements works by specifing type and unit of the element.
0028  *    for example, storage elements are addressed with type = CHET_ST and
0029  *    unit = 0 .. cp_nslots-1
0030  *
0031  */
0032 struct changer_params {
0033     int cp_curpicker;  /* current transport element */
0034     int cp_npickers;   /* number of transport elements      (CHET_MT) */
0035     int cp_nslots;     /* number of storage elements        (CHET_ST) */
0036     int cp_nportals;   /* number of import/export elements  (CHET_IE) */
0037     int cp_ndrives;    /* number of data transfer elements  (CHET_DT) */
0038 };
0039 struct changer_vendor_params {
0040     int  cvp_n1;       /* number of vendor specific elems   (CHET_V1) */
0041     char cvp_label1[16];
0042     int  cvp_n2;       /* number of vendor specific elems   (CHET_V2) */
0043     char cvp_label2[16];
0044     int  cvp_n3;       /* number of vendor specific elems   (CHET_V3) */
0045     char cvp_label3[16];
0046     int  cvp_n4;       /* number of vendor specific elems   (CHET_V4) */
0047     char cvp_label4[16];
0048     int  reserved[8];
0049 };
0050 
0051 
0052 /*
0053  * CHIOMOVE
0054  *    move a medium from one element to another
0055  */
0056 struct changer_move {
0057     int cm_fromtype;    /* type/unit of source element */
0058     int cm_fromunit;    
0059     int cm_totype;  /* type/unit of destination element */
0060     int cm_tounit;
0061     int cm_flags;
0062 };
0063 #define CM_INVERT   1   /* flag: rotate media (for double-sided like MOD) */
0064 
0065 
0066 /*
0067  * CHIOEXCHANGE
0068  *    move one medium from element #1 to element #2,
0069  *    and another one from element #2 to element #3.
0070  *    element #1 and #3 are allowed to be identical.
0071  */
0072 struct changer_exchange {
0073     int ce_srctype;     /* type/unit of element #1 */
0074     int ce_srcunit;
0075     int ce_fdsttype;    /* type/unit of element #2 */
0076     int ce_fdstunit;
0077     int ce_sdsttype;    /* type/unit of element #3 */
0078     int ce_sdstunit;
0079     int ce_flags;
0080 };
0081 #define CE_INVERT1   1
0082 #define CE_INVERT2   2
0083 
0084 
0085 /*
0086  * CHIOPOSITION
0087  *    move the transport element (robot arm) to a specific element.
0088  */
0089 struct changer_position {
0090     int cp_type;
0091     int cp_unit;
0092     int cp_flags;
0093 };
0094 #define CP_INVERT   1
0095 
0096 
0097 /*
0098  * CHIOGSTATUS
0099  *    get element status for all elements of a specific type
0100  */
0101 struct changer_element_status {
0102     int             ces_type;
0103     unsigned char   __user *ces_data;
0104 };
0105 #define CESTATUS_FULL     0x01 /* full */
0106 #define CESTATUS_IMPEXP   0x02  /* media was imported (inserted by sysop) */
0107 #define CESTATUS_EXCEPT   0x04  /* error condition */
0108 #define CESTATUS_ACCESS   0x08  /* access allowed */
0109 #define CESTATUS_EXENAB   0x10  /* element can export media */
0110 #define CESTATUS_INENAB   0x20  /* element can import media */
0111 
0112 
0113 /*
0114  * CHIOGELEM
0115  *    get more detailed status information for a single element
0116  */
0117 struct changer_get_element {
0118     int cge_type;    /* type/unit */
0119     int cge_unit;
0120     int cge_status;      /* status */
0121     int     cge_errno;       /* errno */
0122     int     cge_srctype;     /* source element of the last move/exchange */
0123     int     cge_srcunit;
0124     int     cge_id;          /* scsi id  (for data transfer elements) */
0125     int     cge_lun;         /* scsi lun (for data transfer elements) */
0126     char    cge_pvoltag[36]; /* primary volume tag */
0127     char    cge_avoltag[36]; /* alternate volume tag */
0128     int     cge_flags;
0129 };
0130 /* flags */
0131 #define CGE_ERRNO     0x01       /* errno available       */
0132 #define CGE_INVERT    0x02       /* media inverted        */
0133 #define CGE_SRC       0x04       /* media src available   */
0134 #define CGE_IDLUN     0x08       /* ID+LUN available      */
0135 #define CGE_PVOLTAG   0x10       /* primary volume tag available */
0136 #define CGE_AVOLTAG   0x20       /* alternate volume tag available */
0137 
0138 
0139 /*
0140  * CHIOSVOLTAG
0141  *    set volume tag
0142  */
0143 struct changer_set_voltag {
0144     int csv_type;    /* type/unit */
0145     int csv_unit;
0146     char    csv_voltag[36];  /* volume tag */
0147     int     csv_flags;
0148 };
0149 #define CSV_PVOLTAG   0x01       /* primary volume tag */
0150 #define CSV_AVOLTAG   0x02       /* alternate volume tag */
0151 #define CSV_CLEARTAG  0x04       /* clear volume tag */
0152 
0153 /* ioctls */
0154 #define CHIOMOVE       _IOW('c', 1,struct changer_move)
0155 #define CHIOEXCHANGE   _IOW('c', 2,struct changer_exchange)
0156 #define CHIOPOSITION   _IOW('c', 3,struct changer_position)
0157 #define CHIOGPICKER    _IOR('c', 4,int)                        /* not impl. */
0158 #define CHIOSPICKER    _IOW('c', 5,int)                        /* not impl. */
0159 #define CHIOGPARAMS    _IOR('c', 6,struct changer_params)
0160 #define CHIOGSTATUS    _IOW('c', 8,struct changer_element_status)
0161 #define CHIOGELEM      _IOW('c',16,struct changer_get_element)
0162 #define CHIOINITELEM   _IO('c',17)
0163 #define CHIOSVOLTAG    _IOW('c',18,struct changer_set_voltag)
0164 #define CHIOGVPARAMS   _IOR('c',19,struct changer_vendor_params)
0165 
0166 #endif /* _UAPI_LINUX_CHIO_H */