biovar.h revision 1.1.22.2 1 1.1.22.2 riz /* $NetBSD: biovar.h,v 1.1.22.2 2007/10/15 05:09:53 riz Exp $ */
2 1.1.22.2 riz /* $OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $ */
3 1.1.22.2 riz
4 1.1.22.2 riz /*
5 1.1.22.2 riz * Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
6 1.1.22.2 riz * Copyright (c) 2005 Marco Peereboom. All rights reserved.
7 1.1.22.2 riz *
8 1.1.22.2 riz * Redistribution and use in source and binary forms, with or without
9 1.1.22.2 riz * modification, are permitted provided that the following conditions
10 1.1.22.2 riz * are met:
11 1.1.22.2 riz * 1. Redistributions of source code must retain the above copyright
12 1.1.22.2 riz * notice, this list of conditions and the following disclaimer.
13 1.1.22.2 riz * 2. Redistributions in binary form must reproduce the above copyright
14 1.1.22.2 riz * notice, this list of conditions and the following disclaimer in the
15 1.1.22.2 riz * documentation and/or other materials provided with the distribution.
16 1.1.22.2 riz *
17 1.1.22.2 riz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.1.22.2 riz * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1.22.2 riz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1.22.2 riz * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.1.22.2 riz * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.1.22.2 riz * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.1.22.2 riz * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.1.22.2 riz * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.1.22.2 riz * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.1.22.2 riz * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1.22.2 riz */
28 1.1.22.2 riz
29 1.1.22.2 riz /*
30 1.1.22.2 riz * Devices getting ioctls through this interface should use ioctl class 'B'
31 1.1.22.2 riz * and command numbers starting from 32, lower ones are reserved for generic
32 1.1.22.2 riz * ioctls. All ioctl data must be structures which start with a void *
33 1.1.22.2 riz * cookie.
34 1.1.22.2 riz */
35 1.1.22.2 riz
36 1.1.22.2 riz #include <sys/types.h>
37 1.1.22.2 riz
38 1.1.22.2 riz struct bio_common {
39 1.1.22.2 riz void *bc_cookie;
40 1.1.22.2 riz };
41 1.1.22.2 riz
42 1.1.22.2 riz /* convert name to a cookie */
43 1.1.22.2 riz #define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
44 1.1.22.2 riz struct bio_locate {
45 1.1.22.2 riz void *bl_cookie;
46 1.1.22.2 riz char *bl_name;
47 1.1.22.2 riz };
48 1.1.22.2 riz
49 1.1.22.2 riz #ifdef _KERNEL
50 1.1.22.2 riz int bio_register(struct device *, int (*)(struct device *, u_long,
51 1.1.22.2 riz caddr_t));
52 1.1.22.2 riz void bio_unregister(struct device *);
53 1.1.22.2 riz #endif
54 1.1.22.2 riz
55 1.1.22.2 riz #define BIOCINQ _IOWR('B', 32, struct bioc_inq)
56 1.1.22.2 riz struct bioc_inq {
57 1.1.22.2 riz void *bi_cookie;
58 1.1.22.2 riz
59 1.1.22.2 riz char bi_dev[16]; /* controller device */
60 1.1.22.2 riz int bi_novol; /* nr of volumes */
61 1.1.22.2 riz int bi_nodisk; /* nr of total disks */
62 1.1.22.2 riz };
63 1.1.22.2 riz
64 1.1.22.2 riz #define BIOCDISK _IOWR('B', 33, struct bioc_disk)
65 1.1.22.2 riz /* structure that represents a disk in a RAID volume */
66 1.1.22.2 riz struct bioc_disk {
67 1.1.22.2 riz void *bd_cookie;
68 1.1.22.2 riz
69 1.1.22.2 riz u_int16_t bd_channel;
70 1.1.22.2 riz u_int16_t bd_target;
71 1.1.22.2 riz u_int16_t bd_lun;
72 1.1.22.2 riz u_int16_t bd_other_id; /* unused for now */
73 1.1.22.2 riz
74 1.1.22.2 riz int bd_volid; /* associate with volume */
75 1.1.22.2 riz int bd_diskid; /* virtual disk */
76 1.1.22.2 riz int bd_status; /* current status */
77 1.1.22.2 riz #define BIOC_SDONLINE 0x00
78 1.1.22.2 riz #define BIOC_SDONLINE_S "Online"
79 1.1.22.2 riz #define BIOC_SDOFFLINE 0x01
80 1.1.22.2 riz #define BIOC_SDOFFLINE_S "Offline"
81 1.1.22.2 riz #define BIOC_SDFAILED 0x02
82 1.1.22.2 riz #define BIOC_SDFAILED_S "Failed"
83 1.1.22.2 riz #define BIOC_SDREBUILD 0x03
84 1.1.22.2 riz #define BIOC_SDREBUILD_S "Rebuild"
85 1.1.22.2 riz #define BIOC_SDHOTSPARE 0x04
86 1.1.22.2 riz #define BIOC_SDHOTSPARE_S "Hot spare"
87 1.1.22.2 riz #define BIOC_SDUNUSED 0x05
88 1.1.22.2 riz #define BIOC_SDUNUSED_S "Unused"
89 1.1.22.2 riz #define BIOC_SDSCRUB 0x06
90 1.1.22.2 riz #define BIOC_SDSCRUB_S "Scrubbing"
91 1.1.22.2 riz #define BIOC_SDINVALID 0xff
92 1.1.22.2 riz #define BIOC_SDINVALID_S "Invalid"
93 1.1.22.2 riz size_t bd_size; /* size of the disk */
94 1.1.22.2 riz
95 1.1.22.2 riz char bd_vendor[32]; /* scsi string */
96 1.1.22.2 riz char bd_serial[32]; /* serial number */
97 1.1.22.2 riz char bd_procdev[16]; /* processor device */
98 1.1.22.2 riz };
99 1.1.22.2 riz
100 1.1.22.2 riz #define BIOCVOL _IOWR('B', 34, struct bioc_vol)
101 1.1.22.2 riz /* structure that represents a RAID volume */
102 1.1.22.2 riz struct bioc_vol {
103 1.1.22.2 riz void *bv_cookie;
104 1.1.22.2 riz int bv_volid; /* volume id */
105 1.1.22.2 riz
106 1.1.22.2 riz int16_t bv_percent; /* percent done operation */
107 1.1.22.2 riz u_int16_t bv_seconds; /* seconds of progress so far */
108 1.1.22.2 riz
109 1.1.22.2 riz int bv_status; /* current status */
110 1.1.22.2 riz #define BIOC_SVONLINE 0x00
111 1.1.22.2 riz #define BIOC_SVONLINE_S "Online"
112 1.1.22.2 riz #define BIOC_SVOFFLINE 0x01
113 1.1.22.2 riz #define BIOC_SVOFFLINE_S "Offline"
114 1.1.22.2 riz #define BIOC_SVDEGRADED 0x02
115 1.1.22.2 riz #define BIOC_SVDEGRADED_S "Degraded"
116 1.1.22.2 riz #define BIOC_SVBUILDING 0x03
117 1.1.22.2 riz #define BIOC_SVBUILDING_S "Building"
118 1.1.22.2 riz #define BIOC_SVSCRUB 0x04
119 1.1.22.2 riz #define BIOC_SVSCRUB_S "Scrubbing"
120 1.1.22.2 riz #define BIOC_SVREBUILD 0x05
121 1.1.22.2 riz #define BIOC_SVREBUILD_S "Rebuild"
122 1.1.22.2 riz #define BIOC_SVINVALID 0xff
123 1.1.22.2 riz #define BIOC_SVINVALID_S "Invalid"
124 1.1.22.2 riz size_t bv_size; /* size of the disk */
125 1.1.22.2 riz int bv_level; /* raid level */
126 1.1.22.2 riz int bv_nodisk; /* nr of drives */
127 1.1.22.2 riz
128 1.1.22.2 riz char bv_dev[16]; /* device */
129 1.1.22.2 riz char bv_vendor[32]; /* scsi string */
130 1.1.22.2 riz };
131 1.1.22.2 riz
132 1.1.22.2 riz #define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
133 1.1.22.2 riz struct bioc_alarm {
134 1.1.22.2 riz void *ba_cookie;
135 1.1.22.2 riz int ba_opcode;
136 1.1.22.2 riz
137 1.1.22.2 riz int ba_status; /* only used with get state */
138 1.1.22.2 riz #define BIOC_SADISABLE 0x00 /* disable alarm */
139 1.1.22.2 riz #define BIOC_SAENABLE 0x01 /* enable alarm */
140 1.1.22.2 riz #define BIOC_SASILENCE 0x02 /* silence alarm */
141 1.1.22.2 riz #define BIOC_GASTATUS 0x03 /* get status */
142 1.1.22.2 riz #define BIOC_SATEST 0x04 /* test alarm */
143 1.1.22.2 riz };
144 1.1.22.2 riz
145 1.1.22.2 riz #define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
146 1.1.22.2 riz struct bioc_blink {
147 1.1.22.2 riz void *bb_cookie;
148 1.1.22.2 riz u_int16_t bb_channel;
149 1.1.22.2 riz u_int16_t bb_target;
150 1.1.22.2 riz
151 1.1.22.2 riz int bb_status; /* current status */
152 1.1.22.2 riz #define BIOC_SBUNBLINK 0x00 /* disable blinking */
153 1.1.22.2 riz #define BIOC_SBBLINK 0x01 /* enable blink */
154 1.1.22.2 riz #define BIOC_SBALARM 0x02 /* enable alarm blink */
155 1.1.22.2 riz };
156 1.1.22.2 riz
157 1.1.22.2 riz #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
158 1.1.22.2 riz struct bioc_setstate {
159 1.1.22.2 riz void *bs_cookie;
160 1.1.22.2 riz u_int16_t bs_channel;
161 1.1.22.2 riz u_int16_t bs_target;
162 1.1.22.2 riz u_int16_t bs_lun;
163 1.1.22.2 riz u_int16_t bs_other_id; /* unused for now */
164 1.1.22.2 riz
165 1.1.22.2 riz int bs_status; /* change to this status */
166 1.1.22.2 riz #define BIOC_SSONLINE 0x00 /* online disk */
167 1.1.22.2 riz #define BIOC_SSOFFLINE 0x01 /* offline disk */
168 1.1.22.2 riz #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */
169 1.1.22.2 riz #define BIOC_SSREBUILD 0x03 /* rebuild on this disk */
170 1.1.22.2 riz int bs_volid; /* volume id for rebuild */
171 1.1.22.2 riz };
172 1.1.22.2 riz
173 1.1.22.2 riz #define BIOCCREATERAID _IOWR('B', 38, struct bioc_createraid)
174 1.1.22.2 riz struct bioc_createraid {
175 1.1.22.2 riz void *bc_cookie;
176 1.1.22.2 riz char *bc_dev_list;
177 1.1.22.2 riz u_int16_t bc_dev_list_len;
178 1.1.22.2 riz u_int16_t bc_level;
179 1.1.22.2 riz };
180 1.1.22.2 riz
181 1.1.22.2 riz /* kernel and userspace defines */
182 1.1.22.2 riz #define BIOC_INQ 0x0001
183 1.1.22.2 riz #define BIOC_DISK 0x0002
184 1.1.22.2 riz #define BIOC_VOL 0x0004
185 1.1.22.2 riz #define BIOC_ALARM 0x0008
186 1.1.22.2 riz #define BIOC_BLINK 0x0010
187 1.1.22.2 riz #define BIOC_SETSTATE 0x0020
188 1.1.22.2 riz #define BIOC_CREATERAID 0x0040
189 1.1.22.2 riz
190 1.1.22.2 riz /* user space defines */
191 1.1.22.2 riz #define BIOC_DEVLIST 0x10000
192 1.1.22.2 riz /* $NetBSD: biovar.h,v 1.1.22.2 2007/10/15 05:09:53 riz Exp $ */
193 1.1.22.2 riz /* $OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $ */
194 1.1.22.2 riz
195 1.1.22.2 riz /*
196 1.1.22.2 riz * Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
197 1.1.22.2 riz * Copyright (c) 2005 Marco Peereboom. All rights reserved.
198 1.1.22.2 riz *
199 1.1.22.2 riz * Redistribution and use in source and binary forms, with or without
200 1.1.22.2 riz * modification, are permitted provided that the following conditions
201 1.1.22.2 riz * are met:
202 1.1.22.2 riz * 1. Redistributions of source code must retain the above copyright
203 1.1.22.2 riz * notice, this list of conditions and the following disclaimer.
204 1.1.22.2 riz * 2. Redistributions in binary form must reproduce the above copyright
205 1.1.22.2 riz * notice, this list of conditions and the following disclaimer in the
206 1.1.22.2 riz * documentation and/or other materials provided with the distribution.
207 1.1.22.2 riz *
208 1.1.22.2 riz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
209 1.1.22.2 riz * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
210 1.1.22.2 riz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211 1.1.22.2 riz * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
212 1.1.22.2 riz * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
213 1.1.22.2 riz * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
214 1.1.22.2 riz * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
215 1.1.22.2 riz * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
216 1.1.22.2 riz * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
217 1.1.22.2 riz * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
218 1.1.22.2 riz */
219 1.1.22.2 riz
220 1.1.22.2 riz /*
221 1.1.22.2 riz * Devices getting ioctls through this interface should use ioctl class 'B'
222 1.1.22.2 riz * and command numbers starting from 32, lower ones are reserved for generic
223 1.1.22.2 riz * ioctls. All ioctl data must be structures which start with a void *
224 1.1.22.2 riz * cookie.
225 1.1.22.2 riz */
226 1.1.22.2 riz
227 1.1.22.2 riz #include <sys/types.h>
228 1.1.22.2 riz
229 1.1.22.2 riz struct bio_common {
230 1.1.22.2 riz void *bc_cookie;
231 1.1.22.2 riz };
232 1.1.22.2 riz
233 1.1.22.2 riz /* convert name to a cookie */
234 1.1.22.2 riz #define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
235 1.1.22.2 riz struct bio_locate {
236 1.1.22.2 riz void *bl_cookie;
237 1.1.22.2 riz char *bl_name;
238 1.1.22.2 riz };
239 1.1.22.2 riz
240 1.1.22.2 riz #ifdef _KERNEL
241 1.1.22.2 riz int bio_register(struct device *, int (*)(struct device *, u_long,
242 1.1.22.2 riz caddr_t));
243 1.1.22.2 riz void bio_unregister(struct device *);
244 1.1.22.2 riz #endif
245 1.1.22.2 riz
246 1.1.22.2 riz #define BIOCINQ _IOWR('B', 32, struct bioc_inq)
247 1.1.22.2 riz struct bioc_inq {
248 1.1.22.2 riz void *bi_cookie;
249 1.1.22.2 riz
250 1.1.22.2 riz char bi_dev[16]; /* controller device */
251 1.1.22.2 riz int bi_novol; /* nr of volumes */
252 1.1.22.2 riz int bi_nodisk; /* nr of total disks */
253 1.1.22.2 riz };
254 1.1.22.2 riz
255 1.1.22.2 riz #define BIOCDISK _IOWR('B', 33, struct bioc_disk)
256 1.1.22.2 riz /* structure that represents a disk in a RAID volume */
257 1.1.22.2 riz struct bioc_disk {
258 1.1.22.2 riz void *bd_cookie;
259 1.1.22.2 riz
260 1.1.22.2 riz u_int16_t bd_channel;
261 1.1.22.2 riz u_int16_t bd_target;
262 1.1.22.2 riz u_int16_t bd_lun;
263 1.1.22.2 riz u_int16_t bd_other_id; /* unused for now */
264 1.1.22.2 riz
265 1.1.22.2 riz int bd_volid; /* associate with volume */
266 1.1.22.2 riz int bd_diskid; /* virtual disk */
267 1.1.22.2 riz int bd_status; /* current status */
268 1.1.22.2 riz #define BIOC_SDONLINE 0x00
269 1.1.22.2 riz #define BIOC_SDONLINE_S "Online"
270 1.1.22.2 riz #define BIOC_SDOFFLINE 0x01
271 1.1.22.2 riz #define BIOC_SDOFFLINE_S "Offline"
272 1.1.22.2 riz #define BIOC_SDFAILED 0x02
273 1.1.22.2 riz #define BIOC_SDFAILED_S "Failed"
274 1.1.22.2 riz #define BIOC_SDREBUILD 0x03
275 1.1.22.2 riz #define BIOC_SDREBUILD_S "Rebuild"
276 1.1.22.2 riz #define BIOC_SDHOTSPARE 0x04
277 1.1.22.2 riz #define BIOC_SDHOTSPARE_S "Hot spare"
278 1.1.22.2 riz #define BIOC_SDUNUSED 0x05
279 1.1.22.2 riz #define BIOC_SDUNUSED_S "Unused"
280 1.1.22.2 riz #define BIOC_SDSCRUB 0x06
281 1.1.22.2 riz #define BIOC_SDSCRUB_S "Scrubbing"
282 1.1.22.2 riz #define BIOC_SDINVALID 0xff
283 1.1.22.2 riz #define BIOC_SDINVALID_S "Invalid"
284 1.1.22.2 riz size_t bd_size; /* size of the disk */
285 1.1.22.2 riz
286 1.1.22.2 riz char bd_vendor[32]; /* scsi string */
287 1.1.22.2 riz char bd_serial[32]; /* serial number */
288 1.1.22.2 riz char bd_procdev[16]; /* processor device */
289 1.1.22.2 riz };
290 1.1.22.2 riz
291 1.1.22.2 riz #define BIOCVOL _IOWR('B', 34, struct bioc_vol)
292 1.1.22.2 riz /* structure that represents a RAID volume */
293 1.1.22.2 riz struct bioc_vol {
294 1.1.22.2 riz void *bv_cookie;
295 1.1.22.2 riz int bv_volid; /* volume id */
296 1.1.22.2 riz
297 1.1.22.2 riz int16_t bv_percent; /* percent done operation */
298 1.1.22.2 riz u_int16_t bv_seconds; /* seconds of progress so far */
299 1.1.22.2 riz
300 1.1.22.2 riz int bv_status; /* current status */
301 1.1.22.2 riz #define BIOC_SVONLINE 0x00
302 1.1.22.2 riz #define BIOC_SVONLINE_S "Online"
303 1.1.22.2 riz #define BIOC_SVOFFLINE 0x01
304 1.1.22.2 riz #define BIOC_SVOFFLINE_S "Offline"
305 1.1.22.2 riz #define BIOC_SVDEGRADED 0x02
306 1.1.22.2 riz #define BIOC_SVDEGRADED_S "Degraded"
307 1.1.22.2 riz #define BIOC_SVBUILDING 0x03
308 1.1.22.2 riz #define BIOC_SVBUILDING_S "Building"
309 1.1.22.2 riz #define BIOC_SVSCRUB 0x04
310 1.1.22.2 riz #define BIOC_SVSCRUB_S "Scrubbing"
311 1.1.22.2 riz #define BIOC_SVREBUILD 0x05
312 1.1.22.2 riz #define BIOC_SVREBUILD_S "Rebuild"
313 1.1.22.2 riz #define BIOC_SVINVALID 0xff
314 1.1.22.2 riz #define BIOC_SVINVALID_S "Invalid"
315 1.1.22.2 riz size_t bv_size; /* size of the disk */
316 1.1.22.2 riz int bv_level; /* raid level */
317 1.1.22.2 riz int bv_nodisk; /* nr of drives */
318 1.1.22.2 riz
319 1.1.22.2 riz char bv_dev[16]; /* device */
320 1.1.22.2 riz char bv_vendor[32]; /* scsi string */
321 1.1.22.2 riz };
322 1.1.22.2 riz
323 1.1.22.2 riz #define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
324 1.1.22.2 riz struct bioc_alarm {
325 1.1.22.2 riz void *ba_cookie;
326 1.1.22.2 riz int ba_opcode;
327 1.1.22.2 riz
328 1.1.22.2 riz int ba_status; /* only used with get state */
329 1.1.22.2 riz #define BIOC_SADISABLE 0x00 /* disable alarm */
330 1.1.22.2 riz #define BIOC_SAENABLE 0x01 /* enable alarm */
331 1.1.22.2 riz #define BIOC_SASILENCE 0x02 /* silence alarm */
332 1.1.22.2 riz #define BIOC_GASTATUS 0x03 /* get status */
333 1.1.22.2 riz #define BIOC_SATEST 0x04 /* test alarm */
334 1.1.22.2 riz };
335 1.1.22.2 riz
336 1.1.22.2 riz #define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
337 1.1.22.2 riz struct bioc_blink {
338 1.1.22.2 riz void *bb_cookie;
339 1.1.22.2 riz u_int16_t bb_channel;
340 1.1.22.2 riz u_int16_t bb_target;
341 1.1.22.2 riz
342 1.1.22.2 riz int bb_status; /* current status */
343 1.1.22.2 riz #define BIOC_SBUNBLINK 0x00 /* disable blinking */
344 1.1.22.2 riz #define BIOC_SBBLINK 0x01 /* enable blink */
345 1.1.22.2 riz #define BIOC_SBALARM 0x02 /* enable alarm blink */
346 1.1.22.2 riz };
347 1.1.22.2 riz
348 1.1.22.2 riz #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
349 1.1.22.2 riz struct bioc_setstate {
350 1.1.22.2 riz void *bs_cookie;
351 1.1.22.2 riz u_int16_t bs_channel;
352 1.1.22.2 riz u_int16_t bs_target;
353 1.1.22.2 riz u_int16_t bs_lun;
354 1.1.22.2 riz u_int16_t bs_other_id; /* unused for now */
355 1.1.22.2 riz
356 1.1.22.2 riz int bs_status; /* change to this status */
357 1.1.22.2 riz #define BIOC_SSONLINE 0x00 /* online disk */
358 1.1.22.2 riz #define BIOC_SSOFFLINE 0x01 /* offline disk */
359 1.1.22.2 riz #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */
360 1.1.22.2 riz #define BIOC_SSREBUILD 0x03 /* rebuild on this disk */
361 1.1.22.2 riz int bs_volid; /* volume id for rebuild */
362 1.1.22.2 riz };
363 1.1.22.2 riz
364 1.1.22.2 riz #define BIOCCREATERAID _IOWR('B', 38, struct bioc_createraid)
365 1.1.22.2 riz struct bioc_createraid {
366 1.1.22.2 riz void *bc_cookie;
367 1.1.22.2 riz char *bc_dev_list;
368 1.1.22.2 riz u_int16_t bc_dev_list_len;
369 1.1.22.2 riz u_int16_t bc_level;
370 1.1.22.2 riz };
371 1.1.22.2 riz
372 1.1.22.2 riz /* kernel and userspace defines */
373 1.1.22.2 riz #define BIOC_INQ 0x0001
374 1.1.22.2 riz #define BIOC_DISK 0x0002
375 1.1.22.2 riz #define BIOC_VOL 0x0004
376 1.1.22.2 riz #define BIOC_ALARM 0x0008
377 1.1.22.2 riz #define BIOC_BLINK 0x0010
378 1.1.22.2 riz #define BIOC_SETSTATE 0x0020
379 1.1.22.2 riz #define BIOC_CREATERAID 0x0040
380 1.1.22.2 riz
381 1.1.22.2 riz /* user space defines */
382 1.1.22.2 riz #define BIOC_DEVLIST 0x10000
383 1.1.22.2 riz /* $NetBSD: biovar.h,v 1.1.22.2 2007/10/15 05:09:53 riz Exp $ */
384 1.1.22.2 riz /* $OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $ */
385 1.1.22.2 riz
386 1.1.22.2 riz /*
387 1.1.22.2 riz * Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
388 1.1.22.2 riz * Copyright (c) 2005 Marco Peereboom. All rights reserved.
389 1.1.22.2 riz *
390 1.1.22.2 riz * Redistribution and use in source and binary forms, with or without
391 1.1.22.2 riz * modification, are permitted provided that the following conditions
392 1.1.22.2 riz * are met:
393 1.1.22.2 riz * 1. Redistributions of source code must retain the above copyright
394 1.1.22.2 riz * notice, this list of conditions and the following disclaimer.
395 1.1.22.2 riz * 2. Redistributions in binary form must reproduce the above copyright
396 1.1.22.2 riz * notice, this list of conditions and the following disclaimer in the
397 1.1.22.2 riz * documentation and/or other materials provided with the distribution.
398 1.1.22.2 riz *
399 1.1.22.2 riz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
400 1.1.22.2 riz * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
401 1.1.22.2 riz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
402 1.1.22.2 riz * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
403 1.1.22.2 riz * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
404 1.1.22.2 riz * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
405 1.1.22.2 riz * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
406 1.1.22.2 riz * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
407 1.1.22.2 riz * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
408 1.1.22.2 riz * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
409 1.1.22.2 riz */
410 1.1.22.2 riz
411 1.1.22.2 riz /*
412 1.1.22.2 riz * Devices getting ioctls through this interface should use ioctl class 'B'
413 1.1.22.2 riz * and command numbers starting from 32, lower ones are reserved for generic
414 1.1.22.2 riz * ioctls. All ioctl data must be structures which start with a void *
415 1.1.22.2 riz * cookie.
416 1.1.22.2 riz */
417 1.1.22.2 riz
418 1.1.22.2 riz #include <sys/types.h>
419 1.1.22.2 riz
420 1.1.22.2 riz struct bio_common {
421 1.1.22.2 riz void *bc_cookie;
422 1.1.22.2 riz };
423 1.1.22.2 riz
424 1.1.22.2 riz /* convert name to a cookie */
425 1.1.22.2 riz #define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
426 1.1.22.2 riz struct bio_locate {
427 1.1.22.2 riz void *bl_cookie;
428 1.1.22.2 riz char *bl_name;
429 1.1.22.2 riz };
430 1.1.22.2 riz
431 1.1.22.2 riz #ifdef _KERNEL
432 1.1.22.2 riz int bio_register(struct device *, int (*)(struct device *, u_long,
433 1.1.22.2 riz caddr_t));
434 1.1.22.2 riz void bio_unregister(struct device *);
435 1.1.22.2 riz #endif
436 1.1.22.2 riz
437 1.1.22.2 riz #define BIOCINQ _IOWR('B', 32, struct bioc_inq)
438 1.1.22.2 riz struct bioc_inq {
439 1.1.22.2 riz void *bi_cookie;
440 1.1.22.2 riz
441 1.1.22.2 riz char bi_dev[16]; /* controller device */
442 1.1.22.2 riz int bi_novol; /* nr of volumes */
443 1.1.22.2 riz int bi_nodisk; /* nr of total disks */
444 1.1.22.2 riz };
445 1.1.22.2 riz
446 1.1.22.2 riz #define BIOCDISK _IOWR('B', 33, struct bioc_disk)
447 1.1.22.2 riz /* structure that represents a disk in a RAID volume */
448 1.1.22.2 riz struct bioc_disk {
449 1.1.22.2 riz void *bd_cookie;
450 1.1.22.2 riz
451 1.1.22.2 riz u_int16_t bd_channel;
452 1.1.22.2 riz u_int16_t bd_target;
453 1.1.22.2 riz u_int16_t bd_lun;
454 1.1.22.2 riz u_int16_t bd_other_id; /* unused for now */
455 1.1.22.2 riz
456 1.1.22.2 riz int bd_volid; /* associate with volume */
457 1.1.22.2 riz int bd_diskid; /* virtual disk */
458 1.1.22.2 riz int bd_status; /* current status */
459 1.1.22.2 riz #define BIOC_SDONLINE 0x00
460 1.1.22.2 riz #define BIOC_SDONLINE_S "Online"
461 1.1.22.2 riz #define BIOC_SDOFFLINE 0x01
462 1.1.22.2 riz #define BIOC_SDOFFLINE_S "Offline"
463 1.1.22.2 riz #define BIOC_SDFAILED 0x02
464 1.1.22.2 riz #define BIOC_SDFAILED_S "Failed"
465 1.1.22.2 riz #define BIOC_SDREBUILD 0x03
466 1.1.22.2 riz #define BIOC_SDREBUILD_S "Rebuild"
467 1.1.22.2 riz #define BIOC_SDHOTSPARE 0x04
468 1.1.22.2 riz #define BIOC_SDHOTSPARE_S "Hot spare"
469 1.1.22.2 riz #define BIOC_SDUNUSED 0x05
470 1.1.22.2 riz #define BIOC_SDUNUSED_S "Unused"
471 1.1.22.2 riz #define BIOC_SDSCRUB 0x06
472 1.1.22.2 riz #define BIOC_SDSCRUB_S "Scrubbing"
473 1.1.22.2 riz #define BIOC_SDINVALID 0xff
474 1.1.22.2 riz #define BIOC_SDINVALID_S "Invalid"
475 1.1.22.2 riz size_t bd_size; /* size of the disk */
476 1.1.22.2 riz
477 1.1.22.2 riz char bd_vendor[32]; /* scsi string */
478 1.1.22.2 riz char bd_serial[32]; /* serial number */
479 1.1.22.2 riz char bd_procdev[16]; /* processor device */
480 1.1.22.2 riz };
481 1.1.22.2 riz
482 1.1.22.2 riz #define BIOCVOL _IOWR('B', 34, struct bioc_vol)
483 1.1.22.2 riz /* structure that represents a RAID volume */
484 1.1.22.2 riz struct bioc_vol {
485 1.1.22.2 riz void *bv_cookie;
486 1.1.22.2 riz int bv_volid; /* volume id */
487 1.1.22.2 riz
488 1.1.22.2 riz int16_t bv_percent; /* percent done operation */
489 1.1.22.2 riz u_int16_t bv_seconds; /* seconds of progress so far */
490 1.1.22.2 riz
491 1.1.22.2 riz int bv_status; /* current status */
492 1.1.22.2 riz #define BIOC_SVONLINE 0x00
493 1.1.22.2 riz #define BIOC_SVONLINE_S "Online"
494 1.1.22.2 riz #define BIOC_SVOFFLINE 0x01
495 1.1.22.2 riz #define BIOC_SVOFFLINE_S "Offline"
496 1.1.22.2 riz #define BIOC_SVDEGRADED 0x02
497 1.1.22.2 riz #define BIOC_SVDEGRADED_S "Degraded"
498 1.1.22.2 riz #define BIOC_SVBUILDING 0x03
499 1.1.22.2 riz #define BIOC_SVBUILDING_S "Building"
500 1.1.22.2 riz #define BIOC_SVSCRUB 0x04
501 1.1.22.2 riz #define BIOC_SVSCRUB_S "Scrubbing"
502 1.1.22.2 riz #define BIOC_SVREBUILD 0x05
503 1.1.22.2 riz #define BIOC_SVREBUILD_S "Rebuild"
504 1.1.22.2 riz #define BIOC_SVINVALID 0xff
505 1.1.22.2 riz #define BIOC_SVINVALID_S "Invalid"
506 1.1.22.2 riz size_t bv_size; /* size of the disk */
507 1.1.22.2 riz int bv_level; /* raid level */
508 1.1.22.2 riz int bv_nodisk; /* nr of drives */
509 1.1.22.2 riz
510 1.1.22.2 riz char bv_dev[16]; /* device */
511 1.1.22.2 riz char bv_vendor[32]; /* scsi string */
512 1.1.22.2 riz };
513 1.1.22.2 riz
514 1.1.22.2 riz #define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
515 1.1.22.2 riz struct bioc_alarm {
516 1.1.22.2 riz void *ba_cookie;
517 1.1.22.2 riz int ba_opcode;
518 1.1.22.2 riz
519 1.1.22.2 riz int ba_status; /* only used with get state */
520 1.1.22.2 riz #define BIOC_SADISABLE 0x00 /* disable alarm */
521 1.1.22.2 riz #define BIOC_SAENABLE 0x01 /* enable alarm */
522 1.1.22.2 riz #define BIOC_SASILENCE 0x02 /* silence alarm */
523 1.1.22.2 riz #define BIOC_GASTATUS 0x03 /* get status */
524 1.1.22.2 riz #define BIOC_SATEST 0x04 /* test alarm */
525 1.1.22.2 riz };
526 1.1.22.2 riz
527 1.1.22.2 riz #define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
528 1.1.22.2 riz struct bioc_blink {
529 1.1.22.2 riz void *bb_cookie;
530 1.1.22.2 riz u_int16_t bb_channel;
531 1.1.22.2 riz u_int16_t bb_target;
532 1.1.22.2 riz
533 1.1.22.2 riz int bb_status; /* current status */
534 1.1.22.2 riz #define BIOC_SBUNBLINK 0x00 /* disable blinking */
535 1.1.22.2 riz #define BIOC_SBBLINK 0x01 /* enable blink */
536 1.1.22.2 riz #define BIOC_SBALARM 0x02 /* enable alarm blink */
537 1.1.22.2 riz };
538 1.1.22.2 riz
539 1.1.22.2 riz #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
540 1.1.22.2 riz struct bioc_setstate {
541 1.1.22.2 riz void *bs_cookie;
542 1.1.22.2 riz u_int16_t bs_channel;
543 1.1.22.2 riz u_int16_t bs_target;
544 1.1.22.2 riz u_int16_t bs_lun;
545 1.1.22.2 riz u_int16_t bs_other_id; /* unused for now */
546 1.1.22.2 riz
547 1.1.22.2 riz int bs_status; /* change to this status */
548 1.1.22.2 riz #define BIOC_SSONLINE 0x00 /* online disk */
549 1.1.22.2 riz #define BIOC_SSOFFLINE 0x01 /* offline disk */
550 1.1.22.2 riz #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */
551 1.1.22.2 riz #define BIOC_SSREBUILD 0x03 /* rebuild on this disk */
552 1.1.22.2 riz int bs_volid; /* volume id for rebuild */
553 1.1.22.2 riz };
554 1.1.22.2 riz
555 1.1.22.2 riz #define BIOCCREATERAID _IOWR('B', 38, struct bioc_createraid)
556 1.1.22.2 riz struct bioc_createraid {
557 1.1.22.2 riz void *bc_cookie;
558 1.1.22.2 riz char *bc_dev_list;
559 1.1.22.2 riz u_int16_t bc_dev_list_len;
560 1.1.22.2 riz u_int16_t bc_level;
561 1.1.22.2 riz };
562 1.1.22.2 riz
563 1.1.22.2 riz /* kernel and userspace defines */
564 1.1.22.2 riz #define BIOC_INQ 0x0001
565 1.1.22.2 riz #define BIOC_DISK 0x0002
566 1.1.22.2 riz #define BIOC_VOL 0x0004
567 1.1.22.2 riz #define BIOC_ALARM 0x0008
568 1.1.22.2 riz #define BIOC_BLINK 0x0010
569 1.1.22.2 riz #define BIOC_SETSTATE 0x0020
570 1.1.22.2 riz #define BIOC_CREATERAID 0x0040
571 1.1.22.2 riz
572 1.1.22.2 riz /* user space defines */
573 1.1.22.2 riz #define BIOC_DEVLIST 0x10000
574