FreeBSD/Linux Kernel Cross Reference
sys/sys/chio.h
1 /*
2 * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgements:
15 * This product includes software developed by Jason R. Thorpe
16 * for And Communications, http://www.and.com/
17 * 4. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: src/sys/sys/chio.h,v 1.7.2.3 1999/09/05 08:22:02 peter Exp $
33 */
34
35 #ifndef _SYS_CHIO_H_
36 #define _SYS_CHIO_H_
37
38 #ifndef KERNEL
39 #include <sys/types.h>
40 #endif
41 #include <sys/ioccom.h>
42
43 /*
44 * Element types. Used as "to" and "from" type indicators in move
45 * and exchange operations.
46 *
47 * Note that code in sys/scsi/ch.c relies on these values (uses them
48 * as offsets in an array, and other evil), so don't muck with them
49 * unless you know what you're doing.
50 */
51 #define CHET_MT 0 /* medium transport (picker) */
52 #define CHET_ST 1 /* storage transport (slot) */
53 #define CHET_IE 2 /* import/export (portal) */
54 #define CHET_DT 3 /* data transfer (drive) */
55
56 /*
57 * Structure used to execute a MOVE MEDIUM command.
58 */
59 struct changer_move {
60 int cm_fromtype; /* element type to move from */
61 int cm_fromunit; /* logical unit of from element */
62 int cm_totype; /* element type to move to */
63 int cm_tounit; /* logical unit of to element */
64 int cm_flags; /* misc. flags */
65 };
66
67 /* cm_flags */
68 #define CM_INVERT 0x01 /* invert media */
69
70 /*
71 * Structure used to execute an EXCHANGE MEDIUM command. In an
72 * exchange operation, the following steps occur:
73 *
74 * - media from source is moved to first destination.
75 *
76 * - media previously occupying first destination is moved
77 * to the second destination.
78 *
79 * The second destination may or may not be the same as the source.
80 * In the case of a simple exchange, the source and second destination
81 * are the same.
82 */
83 struct changer_exchange {
84 int ce_srctype; /* element type of source */
85 int ce_srcunit; /* logical unit of source */
86 int ce_fdsttype; /* element type of first destination */
87 int ce_fdstunit; /* logical unit of first destination */
88 int ce_sdsttype; /* element type of second destination */
89 int ce_sdstunit; /* logical unit of second destination */
90 int ce_flags; /* misc. flags */
91 };
92
93 /* ce_flags */
94 #define CE_INVERT1 0x01 /* invert media 1 */
95 #define CE_INVERT2 0x02 /* invert media 2 */
96
97 /*
98 * Structure used to execute a POSITION TO ELEMENT command. This
99 * moves the current picker in front of the specified element.
100 */
101 struct changer_position {
102 int cp_type; /* element type */
103 int cp_unit; /* logical unit of element */
104 int cp_flags; /* misc. flags */
105 };
106
107 /* cp_flags */
108 #define CP_INVERT 0x01 /* invert picker */
109
110 /*
111 * Data returned by CHIOGPARAMS.
112 */
113 struct changer_params {
114 int cp_curpicker; /* current picker */
115 int cp_npickers; /* number of pickers */
116 int cp_nslots; /* number of slots */
117 int cp_nportals; /* number of import/export portals */
118 int cp_ndrives; /* number of drives */
119 };
120
121 /*
122 * Command used to get element status.
123 */
124 struct changer_element_status {
125 int ces_type; /* element type */
126 u_int8_t *ces_data; /* pre-allocated data storage */
127 };
128
129 /*
130 * Data returned by CHIOGSTATUS is an array of flags bytes.
131 * Not all flags have meaning for all element types.
132 */
133 #define CESTATUS_FULL 0x01 /* element is full */
134 #define CESTATUS_IMPEXP 0x02 /* media deposited by operator */
135 #define CESTATUS_EXCEPT 0x04 /* element in abnormal state */
136 #define CESTATUS_ACCESS 0x08 /* media accessible by picker */
137 #define CESTATUS_EXENAB 0x10 /* element supports exporting */
138 #define CESTATUS_INENAB 0x20 /* element supports importing */
139
140 #define CESTATUS_PICKER_MASK 0x05 /* flags valid for pickers */
141 #define CESTATUS_SLOT_MASK 0x0c /* flags valid for slots */
142 #define CESTATUS_PORTAL_MASK 0x3f /* flags valid for portals */
143 #define CESTATUS_DRIVE_MASK 0x0c /* flags valid for drives */
144
145 #define CESTATUS_BITS \
146 "\2\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
147
148 #define CHIOMOVE _IOW('c', 0x01, struct changer_move)
149 #define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange)
150 #define CHIOPOSITION _IOW('c', 0x03, struct changer_position)
151 #define CHIOGPICKER _IOR('c', 0x04, int)
152 #define CHIOSPICKER _IOW('c', 0x05, int)
153 #define CHIOGPARAMS _IOR('c', 0x06, struct changer_params)
154 #define CHIOGSTATUS _IOW('c', 0x08, struct changer_element_status)
155
156 #endif /* !_SYS_CHIO_H_ */
Cache object: 01ca73c68edab1d69dcda4dcdf428dac
|