1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * ioctl interface for the scsi media changer driver
6 /* changer element types */
7 #define CHET_MT 0 /* media transport element (robot) */
8 #define CHET_ST 1 /* storage element (media slots) */
9 #define CHET_IE 2 /* import/export element */
10 #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */
11 #define CHET_V1 4 /* vendor specific #1 */
12 #define CHET_V2 5 /* vendor specific #2 */
13 #define CHET_V3 6 /* vendor specific #3 */
14 #define CHET_V4 7 /* vendor specific #4 */
19 * query changer properties
22 * query vendor-specific element types
24 * accessing elements works by specifing type and unit of the element.
25 * for example, storage elements are addressed with type = CHET_ST and
26 * unit = 0 .. cp_nslots-1
29 struct changer_params {
30 int cp_curpicker; /* current transport element */
31 int cp_npickers; /* number of transport elements (CHET_MT) */
32 int cp_nslots; /* number of storage elements (CHET_ST) */
33 int cp_nportals; /* number of import/export elements (CHET_IE) */
34 int cp_ndrives; /* number of data transfer elements (CHET_DT) */
36 struct changer_vendor_params {
37 int cvp_n1; /* number of vendor specific elems (CHET_V1) */
39 int cvp_n2; /* number of vendor specific elems (CHET_V2) */
41 int cvp_n3; /* number of vendor specific elems (CHET_V3) */
43 int cvp_n4; /* number of vendor specific elems (CHET_V4) */
51 * move a medium from one element to another
54 int cm_fromtype; /* type/unit of source element */
56 int cm_totype; /* type/unit of destination element */
60 #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */
65 * move one medium from element #1 to element #2,
66 * and another one from element #2 to element #3.
67 * element #1 and #3 are allowed to be identical.
69 struct changer_exchange {
70 int ce_srctype; /* type/unit of element #1 */
72 int ce_fdsttype; /* type/unit of element #2 */
74 int ce_sdsttype; /* type/unit of element #3 */
84 * move the transport element (robot arm) to a specific element.
86 struct changer_position {
96 * get element status for all elements of a specific type
98 struct changer_element_status {
100 unsigned char __user *ces_data;
102 #define CESTATUS_FULL 0x01 /* full */
103 #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
104 #define CESTATUS_EXCEPT 0x04 /* error condition */
105 #define CESTATUS_ACCESS 0x08 /* access allowed */
106 #define CESTATUS_EXENAB 0x10 /* element can export media */
107 #define CESTATUS_INENAB 0x20 /* element can import media */
112 * get more detailed status information for a single element
114 struct changer_get_element {
115 int cge_type; /* type/unit */
117 int cge_status; /* status */
118 int cge_errno; /* errno */
119 int cge_srctype; /* source element of the last move/exchange */
121 int cge_id; /* scsi id (for data transfer elements) */
122 int cge_lun; /* scsi lun (for data transfer elements) */
123 char cge_pvoltag[36]; /* primary volume tag */
124 char cge_avoltag[36]; /* alternate volume tag */
128 #define CGE_ERRNO 0x01 /* errno available */
129 #define CGE_INVERT 0x02 /* media inverted */
130 #define CGE_SRC 0x04 /* media src available */
131 #define CGE_IDLUN 0x08 /* ID+LUN available */
132 #define CGE_PVOLTAG 0x10 /* primary volume tag available */
133 #define CGE_AVOLTAG 0x20 /* alternate volume tag available */
140 struct changer_set_voltag {
141 int csv_type; /* type/unit */
143 char csv_voltag[36]; /* volume tag */
146 #define CSV_PVOLTAG 0x01 /* primary volume tag */
147 #define CSV_AVOLTAG 0x02 /* alternate volume tag */
148 #define CSV_CLEARTAG 0x04 /* clear volume tag */
151 #define CHIOMOVE _IOW('c', 1,struct changer_move)
152 #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange)
153 #define CHIOPOSITION _IOW('c', 3,struct changer_position)
154 #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */
155 #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */
156 #define CHIOGPARAMS _IOR('c', 6,struct changer_params)
157 #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status)
158 #define CHIOGELEM _IOW('c',16,struct changer_get_element)
159 #define CHIOINITELEM _IO('c',17)
160 #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag)
161 #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params)
163 /* ---------------------------------------------------------------------- */