1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Volume Management Mux Driver Interface
*/
#ifndef _SYS_VOL_H
#define _SYS_VOL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <rpc/types.h>
#include <sys/ioccom.h>
#include <sys/param.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The labelent structures tell the driver where labels might be found,
* so the driver can watch this range of addresses and tell us
* (via the VIE_NEWLABEL event) when someone writes to one. It
* also allows the driver to "blot out" the label from reads and
* writes, if desired.
*/
struct vio_labelent {
off_t vl_off; /* label offset (in bytes) */
size_t vl_len; /* length of the label */
bool_t vl_mapout; /* map the label out? */
};
#ifdef _SYSCALL32
struct vio_labelent32 {
off32_t vl_off; /* label offset (in bytes) */
size32_t vl_len; /* length of the label */
int32_t vl_mapout; /* map the label out? */
};
#endif /* _SYSCALL32 */
/*
* Map our unit number (vim_unit) to a dev_t representing a
* real driver (vim_dev).
*/
struct vioc_map {
dev_t vim_dev; /* device (full name) to map to */
caddr_t vim_path; /* path name of device */
size_t vim_pathlen; /* string + 0 */
minor_t vim_unit; /* unit number (minor number) */
dev_t vim_basedev; /* device to return for errs &c. */
uint64_t vim_id; /* id of the volume */
uint_t vim_nvl; /* number of vio_labelent structs */
struct vio_labelent *vim_vl; /* list of where labels are */
uint_t vim_flags; /* flags */
};
#ifdef _SYSCALL32
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack(4)
#endif
struct vioc_map32 {
dev32_t vim_dev; /* device (full name) to map to */
caddr32_t vim_path; /* path name of device */
size32_t vim_pathlen; /* string + 0 */
minor32_t vim_unit; /* unit number (minor number) */
dev32_t vim_basedev; /* device to return for errs &c. */
uint64_t vim_id; /* id of the volume */
uint32_t vim_nvl; /* number of vio_labelent structs */
caddr32_t vim_vl; /* list of where labels are */
uint32_t vim_flags; /* flags */
};
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack()
#endif
#endif /* _SYSCALL32 */
#define VIM_FLOPPY 0x0001 /* device is a floppy */
#define VIM_RDONLY 0x0002 /* volume is read only */
#define MAX_ATTR_LEN 128 /* max size for attr or value */
struct vioc_dattr {
minor_t vda_unit; /* unit number */
char vda_value[MAX_ATTR_LEN]; /* value */
int vda_errno; /* error */
};
#ifdef _SYSCALL32
struct vioc_dattr32 {
minor32_t vda_unit; /* unit number */
char vda_value[MAX_ATTR_LEN]; /* value */
int32_t vda_errno; /* error */
};
#endif /* _SYSCALL32 */
/*
* Passed from daemon to driver to specify what action should happen on
* eject. This is in response to a VIE_EJECT event.
*/
enum eject_state {
VEJ_YES, /* eject is okay, send eject */
VEJ_NO, /* eject is denied, don't send eject */
VEJ_YESSTOP, /* eject is okay, don't send eject */
VEJ_NONE /* no state */
};
struct vioc_eject {
minor_t viej_unit;
enum eject_state viej_state;
};
#ifdef _SYSCALL32
struct vioc_eject32 {
minor32_t viej_unit;
int32_t viej_state;
};
#endif /* _SYSCALL32 */
struct vioc_flags {
minor_t vfl_unit; /* unit number */
uint_t vfl_flags; /* flags to set */
};
#ifdef _SYSCALL32
struct vioc_flags32 {
minor32_t vfl_unit; /* unit number */
uint32_t vfl_flags; /* flags to set */
};
#endif /* _SYSCALL32 */
#define VFL_ENXIO 0x0001 /* enxio on unmap */
/*
* structure to provide buffer size of a passed in
* string so kernel can use ddi
*/
struct vol_str {
caddr_t data; /* the addr of string */
size_t data_len; /* buffer size of string */
};
#ifdef _SYSCALL32
struct vol_str32 {
caddr32_t data; /* the addr of string */
size32_t data_len; /* buffer size of string */
};
#endif /* _SYSCALL32 */
/*
* returned in response to VOLIOCINFO
*/
struct vioc_info {
uint_t vii_inuse; /* others using volume */
uint64_t vii_id; /* id of the volume */
caddr_t vii_devpath; /* path name of mapped device */
size_t vii_pathlen; /* buffer size of passed in devpath */
};
#ifdef _SYSCALL32
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack(4)
#endif
struct vioc_info32 {
uint32_t vii_inuse; /* others using volume */
uint64_t vii_id; /* id of the volume */
caddr32_t vii_devpath; /* path name of mapped device */
size32_t vii_pathlen; /* buffer size of passed in devpath */
};
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack()
#endif
#endif /* _SYSCALL32 */
struct vioc_sattr {
caddr_t sa_attr; /* name of the attribute */
caddr_t sa_value; /* value of the attribute */
size_t sa_attr_len; /* length of str sa_attr */
size_t sa_value_len; /* length of value string */
};
#ifdef _SYSCALL32
struct vioc_sattr32 {
caddr32_t sa_attr; /* name of the attribute */
caddr32_t sa_value; /* value of the attribute */
size32_t sa_attr_len; /* length of str sa_attr */
size32_t sa_value_len; /* length of value string */
};
#endif /* _SYSCALL32 */
struct vioc_gattr {
caddr_t ga_attr; /* name of the attribute */
caddr_t ga_value; /* value of the attribute */
size_t ga_val_len; /* size of value buffer */
size_t ga_attr_len; /* size of attr buffer */
};
#ifdef _SYSCALL32
struct vioc_gattr32 {
caddr32_t ga_attr; /* name of the attribute */
caddr32_t ga_value; /* value of the attribute */
size32_t ga_val_len; /* size of value buffer */
size32_t ga_attr_len; /* size of attr buffer */
};
#endif /* _SYSCALL32 */
/* for the VOLIOCSYMNAME ioctl */
struct vioc_symname {
dev_t sn_dev; /* dev to find symname of */
caddr_t sn_symname; /* where symname gets returned */
size_t sn_pathlen; /* max length to return */
};
#ifdef _SYSCALL32
struct vioc_symname32 {
dev32_t sn_dev; /* dev to find symname of */
caddr32_t sn_symname; /* where symname gets returned */
size32_t sn_pathlen; /* max length to return */
};
#endif /* _SYSCALL32 */
/* for the VOLIOCSYMDEV ioctl */
struct vioc_symdev {
caddr_t sd_symname; /* symname to find dev name for */
caddr_t sd_symdevname; /* where dev pathname gets returned */
size_t sd_pathlen; /* max length to return */
size_t sd_symnamelen; /* length of the symname */
};
#ifdef _SYSCALL32
struct vioc_symdev32 {
caddr32_t sd_symname; /* symname to find dev name for */
caddr32_t sd_symdevname; /* where dev pathname gets returned */
size32_t sd_pathlen; /* max length to return */
size32_t sd_symnamelen; /* length of the symname */
};
#endif /* _SYSCALL32 */
#if defined(_LONGLONG_TYPE)
#define VOLID_TMP 0xff00000000000000ull
#else
#define VOLID_TMP 0xff000000
#endif
/*
* max size of a device pathname in /dev (e.g. "/dev/diskette0")
*/
#define VOL_SYMDEV_LEN (MAXPATHLEN)
/*
* max size of aliases pathname in /vol (e.g. "floppy0")
*/
#define VOL_SYMNAME_LEN (MAXNAMELEN)
/*
* Possible events that the drive can generate for the daemon.
*/
enum vie_event {
VIE_MISSING, /* driver has no mapping */
VIE_EJECT, /* eject has been requested */
VIE_DEVERR, /* error seen from device */
VIE_CLOSE, /* last close on device from userland */
VIE_CANCEL, /* user has cancelled pending i/o */
VIE_NEWLABEL, /* a new label has been written to device */
VIE_INSERT, /* new media has arrived */
VIE_GETATTR, /* get an attribute */
VIE_SETATTR, /* set an attribute */
VIE_INUSE, /* check to see if a device is in use */
VIE_CHECK, /* check a device to see if media is there */
VIE_REMOVED, /* media was removed from device */
VIE_SYMNAME, /* for volmgt_symname() */
VIE_SYMDEV, /* for volmgt_symdev() */
VIE_REMOUNT /* the medium's file system structure has changed */
};
/*
* This structure is used for communication between the daemon and
* the driver.
*/
struct vioc_event {
enum vie_event vie_type; /* type of the event */
union {
/*
* A unit has been opened for which we don't
* have a mapping.
*/
struct ve_missing {
minor_t viem_unit; /* missing unit # */
bool_t viem_ndelay; /* don't look for volume */
uid_t viem_user; /* uid of requester */
dev_t viem_tty; /* cont tty of req */
} vie_u_missing;
/*
* A request has been made to eject a unit.
*/
struct ve_eject {
minor_t viej_unit; /* unit eject seen on */
uid_t viej_user; /* uid of requester */
dev_t viej_tty; /* tty of requester */
int viej_force; /* DEPRECIATED */
} vie_u_eject;
/*
* New media has arrived.
*/
struct ve_insert {
dev_t viei_dev;
} vie_u_insert;
/*
* User wants us to see if a device is in use.
*/
struct ve_inuse {
dev_t vieu_dev;
} vie_u_inuse;
/*
* User wants us to see if media has arrived in a device.
*/
struct ve_check {
dev_t viec_dev;
} vie_u_check;
/*
* An error has been returned from a device
*/
struct ve_error {
dev_t viee_dev; /* dev_t of error */
uint_t viee_errno; /* errno returned */
} vie_u_error;
/*
* "last" close on a unit.
*/
struct ve_close {
minor_t viecl_unit; /* unit # finished with */
} vie_u_close;
/*
* user has "interrupted" (^C) a pending operation.
*/
struct ve_cancel {
minor_t viec_unit; /* unit # aborted */
} vie_u_cancel;
/*
* New label has been written.
*/
struct ve_newlabel {
minor_t vien_unit; /* unit # new label seen on */
} vie_u_newlabel;
/*
* Set or get an attribute
*/
struct ve_attr {
minor_t viea_unit;
char viea_attr[MAX_ATTR_LEN+1];
char viea_value[MAX_ATTR_LEN+1];
uid_t viea_uid;
gid_t viea_gid;
} vie_u_attr;
struct ve_rm {
minor_t virm_unit;
} vie_u_rm;
/*
* user wants to find the symname for a dev path
*/
struct ve_symname {
dev_t vies_dev;
} vie_u_symname;
/*
* user wants to find the dev path for a symname
*/
struct ve_symdev {
char vied_symname[VOL_SYMNAME_LEN+1];
} vie_u_symdev;
/*
* Medium's partition structure has changed
*/
struct ve_remount {
minor_t vier_unit; /* repartitioned unit # */
} vie_u_remount;
} vie_un;
};
#ifdef _SYSCALL32
struct vioc_event32 {
int32_t vie_type; /* type of the event */
union {
/*
* A unit has been opened for which we don't
* have a mapping.
*/
struct ve_missing32 {
minor32_t viem_unit; /* missing unit # */
int32_t viem_ndelay; /* don't look for volume */
uid32_t viem_user; /* uid of requester */
dev32_t viem_tty; /* cont tty of req */
} vie_u_missing;
/*
* A request has been made to eject a unit.
*/
struct ve_eject32 {
minor32_t viej_unit; /* unit eject seen on */
uid32_t viej_user; /* uid of requester */
dev32_t viej_tty; /* tty of requester */
int32_t viej_force; /* DEPRECIATED */
} vie_u_eject;
/*
* New media has arrived.
*/
struct ve_insert32 {
dev32_t viei_dev;
} vie_u_insert;
/*
* User wants us to see if a device is in use.
*/
struct ve_inuse32 {
dev32_t vieu_dev;
} vie_u_inuse;
/*
* User wants us to see if media has arrived in a device.
*/
struct ve_check32 {
dev32_t viec_dev;
} vie_u_check;
/*
* An error has been returned from a device
*/
struct ve_error32 {
dev32_t viee_dev; /* dev_t of error */
uint32_t viee_errno; /* errno returned */
} vie_u_error;
/*
* "last" close on a unit.
*/
struct ve_close32 {
minor32_t viecl_unit; /* unit # finished with */
} vie_u_close;
/*
* user has "interrupted" (^C) a pending operation.
*/
struct ve_cancel32 {
minor32_t viec_unit; /* unit # aborted */
} vie_u_cancel;
/*
* New label has been written.
*/
struct ve_newlabel32 {
minor32_t vien_unit; /* unit # new label seen on */
} vie_u_newlabel;
/*
* Set or get an attribute
*/
struct ve_attr32 {
minor32_t viea_unit;
char viea_attr[MAX_ATTR_LEN+1];
char viea_value[MAX_ATTR_LEN+1];
uid32_t viea_uid;
gid32_t viea_gid;
} vie_u_attr;
struct ve_rm32 {
minor32_t virm_unit;
} vie_u_rm;
/*
* user wants to find the symname for a dev path
*/
struct ve_symname32 {
dev32_t vies_dev;
} vie_u_symname;
/*
* user wants to find the dev path for a symname
*/
struct ve_symdev32 {
char vied_symname[VOL_SYMNAME_LEN+1];
} vie_u_symdev;
/*
* Medium has new partition structure
*/
struct ve_remount32 {
minor32_t vier_unit; /* repartitioned unit # */
} vie_u_remount;
} vie_un;
};
#endif /* _SYSCALL32 */
#define vie_missing vie_un.vie_u_missing
#define vie_eject vie_un.vie_u_eject
#define vie_insert vie_un.vie_u_insert
#define vie_error vie_un.vie_u_error
#define vie_close vie_un.vie_u_close
#define vie_cancel vie_un.vie_u_cancel
#define vie_newlabel vie_un.vie_u_newlabel
#define vie_attr vie_un.vie_u_attr
#define vie_inuse vie_un.vie_u_inuse
#define vie_check vie_un.vie_u_check
#define vie_rm vie_un.vie_u_rm
#define vie_symname vie_un.vie_u_symname
#define vie_symdev vie_un.vie_u_symdev
#define vie_remount vie_un.vie_u_remount
/*
* These ioctl numbers have been allocated and approved by USL.
*/
#define VOLIOC ('v' << 8)
/* "control" ioctls (i.e. only valid on unit 0) */
#define VOLIOCMAP (VOLIOC|1) /* build a volume to device mapping */
#define VOLIOCUNMAP (VOLIOC|2) /* remove a mapping */
#define VOLIOCEVENT (VOLIOC|3) /* read an event */
#define VOLIOCEJECT (VOLIOC|4) /* allow/deny ejection */
#define VOLIOCDGATTR (VOLIOC|7) /* daemon getattr */
#define VOLIOCDSATTR (VOLIOC|8) /* daemon setattr */
#define VOLIOCDCHECK (VOLIOC|9) /* daemon response to check */
#define VOLIOCDINUSE (VOLIOC|14) /* daemon response to inuse */
#define VOLIOCDAEMON (VOLIOC|15) /* daemon set's pid */
#define VOLIOCFLAGS (VOLIOC|16) /* set flags on a mapping */
#define VOLIOCDROOT (VOLIOC|17) /* tell driver where vol root is */
#define VOLIOCDSYMNAME (VOLIOC|20) /* for volmgt_symname() */
#define VOLIOCDSYMDEV (VOLIOC|21) /* for volmgt_symdev() */
#define VOLIOCCMINOR (VOLIOC|24) /* create minor unit name */
#define VOLIOCRMINOR (VOLIOC|25) /* remove minor unit name */
/* "user" ioctls */
#define VOLIOCINUSE (VOLIOC|6) /* is a device "in use"? */
#define VOLIOCCHECK (VOLIOC|5) /* check a device for media */
#define VOLIOCCANCEL (VOLIOC|10) /* cancel pending i/o */
#define VOLIOCINFO (VOLIOC|11) /* get info about a volume */
#define VOLIOCSATTR (VOLIOC|12) /* set an attribute */
#define VOLIOCGATTR (VOLIOC|13) /* get an attribute */
#define VOLIOCROOT (VOLIOC|18) /* find out where vol root is */
#define VOLIOCSYMNAME (VOLIOC|19) /* for volmgt_symname() */
#define VOLIOCSYMDEV (VOLIOC|22) /* for volmgt_symdev() */
#define VOLIOCREMOUNT (VOLIOC|23) /* medium has new partitions */
/* Name of control port (unit 0), i.e. /dev/%s */
#define VOLCTLNAME "volctl"
#define VOLUNITNAME_BLK "u%d"
#define VOLUNITNAME_CHR "u%d,raw"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_VOL_H */
|