locks: fix setlease methods to free passed-in lock
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / chio.h
blobd9bac7f97282e3596a5736be5614b606e5c09561
1 /*
2 * ioctl interface for the scsi media changer driver
3 */
5 /* changer element types */
6 #define CHET_MT 0 /* media transport element (robot) */
7 #define CHET_ST 1 /* storage element (media slots) */
8 #define CHET_IE 2 /* import/export element */
9 #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */
10 #define CHET_V1 4 /* vendor specific #1 */
11 #define CHET_V2 5 /* vendor specific #2 */
12 #define CHET_V3 6 /* vendor specific #3 */
13 #define CHET_V4 7 /* vendor specific #4 */
17 * CHIOGPARAMS
18 * query changer properties
20 * CHIOVGPARAMS
21 * query vendor-specific element types
23 * accessing elements works by specifing type and unit of the element.
24 * for example, storage elements are addressed with type = CHET_ST and
25 * unit = 0 .. cp_nslots-1
28 struct changer_params {
29 int cp_curpicker; /* current transport element */
30 int cp_npickers; /* number of transport elements (CHET_MT) */
31 int cp_nslots; /* number of storage elements (CHET_ST) */
32 int cp_nportals; /* number of import/export elements (CHET_IE) */
33 int cp_ndrives; /* number of data transfer elements (CHET_DT) */
35 struct changer_vendor_params {
36 int cvp_n1; /* number of vendor specific elems (CHET_V1) */
37 char cvp_label1[16];
38 int cvp_n2; /* number of vendor specific elems (CHET_V2) */
39 char cvp_label2[16];
40 int cvp_n3; /* number of vendor specific elems (CHET_V3) */
41 char cvp_label3[16];
42 int cvp_n4; /* number of vendor specific elems (CHET_V4) */
43 char cvp_label4[16];
44 int reserved[8];
49 * CHIOMOVE
50 * move a medium from one element to another
52 struct changer_move {
53 int cm_fromtype; /* type/unit of source element */
54 int cm_fromunit;
55 int cm_totype; /* type/unit of destination element */
56 int cm_tounit;
57 int cm_flags;
59 #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */
63 * CHIOEXCHANGE
64 * move one medium from element #1 to element #2,
65 * and another one from element #2 to element #3.
66 * element #1 and #3 are allowed to be identical.
68 struct changer_exchange {
69 int ce_srctype; /* type/unit of element #1 */
70 int ce_srcunit;
71 int ce_fdsttype; /* type/unit of element #2 */
72 int ce_fdstunit;
73 int ce_sdsttype; /* type/unit of element #3 */
74 int ce_sdstunit;
75 int ce_flags;
77 #define CE_INVERT1 1
78 #define CE_INVERT2 2
82 * CHIOPOSITION
83 * move the transport element (robot arm) to a specific element.
85 struct changer_position {
86 int cp_type;
87 int cp_unit;
88 int cp_flags;
90 #define CP_INVERT 1
94 * CHIOGSTATUS
95 * get element status for all elements of a specific type
97 struct changer_element_status {
98 int ces_type;
99 unsigned char __user *ces_data;
101 #define CESTATUS_FULL 0x01 /* full */
102 #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
103 #define CESTATUS_EXCEPT 0x04 /* error condition */
104 #define CESTATUS_ACCESS 0x08 /* access allowed */
105 #define CESTATUS_EXENAB 0x10 /* element can export media */
106 #define CESTATUS_INENAB 0x20 /* element can import media */
110 * CHIOGELEM
111 * get more detailed status information for a single element
113 struct changer_get_element {
114 int cge_type; /* type/unit */
115 int cge_unit;
116 int cge_status; /* status */
117 int cge_errno; /* errno */
118 int cge_srctype; /* source element of the last move/exchange */
119 int cge_srcunit;
120 int cge_id; /* scsi id (for data transfer elements) */
121 int cge_lun; /* scsi lun (for data transfer elements) */
122 char cge_pvoltag[36]; /* primary volume tag */
123 char cge_avoltag[36]; /* alternate volume tag */
124 int cge_flags;
126 /* flags */
127 #define CGE_ERRNO 0x01 /* errno available */
128 #define CGE_INVERT 0x02 /* media inverted */
129 #define CGE_SRC 0x04 /* media src available */
130 #define CGE_IDLUN 0x08 /* ID+LUN available */
131 #define CGE_PVOLTAG 0x10 /* primary volume tag available */
132 #define CGE_AVOLTAG 0x20 /* alternate volume tag available */
136 * CHIOSVOLTAG
137 * set volume tag
139 struct changer_set_voltag {
140 int csv_type; /* type/unit */
141 int csv_unit;
142 char csv_voltag[36]; /* volume tag */
143 int csv_flags;
145 #define CSV_PVOLTAG 0x01 /* primary volume tag */
146 #define CSV_AVOLTAG 0x02 /* alternate volume tag */
147 #define CSV_CLEARTAG 0x04 /* clear volume tag */
149 /* ioctls */
150 #define CHIOMOVE _IOW('c', 1,struct changer_move)
151 #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange)
152 #define CHIOPOSITION _IOW('c', 3,struct changer_position)
153 #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */
154 #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */
155 #define CHIOGPARAMS _IOR('c', 6,struct changer_params)
156 #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status)
157 #define CHIOGELEM _IOW('c',16,struct changer_get_element)
158 #define CHIOINITELEM _IO('c',17)
159 #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag)
160 #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params)
162 /* ---------------------------------------------------------------------- */
165 * Local variables:
166 * c-basic-offset: 8
167 * End: