]>
git.saurik.com Git - apple/boot.git/blob - i386/libsaio/legacy/disk.h
02ee90eece511d7e3a4af79ce7cc67477dc0addf
1 /* @(#)disk.h 1.0 08/29/87 (c) 1987 NeXT */
5 * 28-Mar-92 Doug Mitchell
6 * Moved disk_label struct to <bsd/dev/disk_label.h>.
8 * 22-May-91 Gregg Kellogg (gk) at NeXT
9 * Split out public interface.
11 * 20-Jul-90 Doug Mitchell
12 * Added DKIOCSFORMAT, DKIOCGFORMAT
14 * 16-Apr-90 Doug Mitchell at NeXT
15 * Added DKIOCPANELPRT.
17 * 25-Mar-90 John Seamons (jks) at NeXT
18 * Removed obsolete DKIOCNOTIFY and DKIOCINSERT.
20 * 23-Mar-90 Doug Mitchell
23 * 14-Feb-90 Doug Mitchell at NeXT
26 * 16-Mar-88 John Seamons (jks) at NeXT
27 * Cleaned up to support standard disk label definitions.
29 * 24-Feb-88 Mike DeMoney (mike) at NeXT
30 * Added defines for dl_bootfile and dl_boot0_blkno.
31 * Reduced NBAD to allow for these entries in disktab.
33 * 29-Aug-87 John Seamons (jks) at NeXT
38 #ifndef _BSD_DEV_DISK_
39 #define _BSD_DEV_DISK_
41 #include <mach/machine/vm_types.h>
42 #include <mach/machine/boolean.h>
43 #include <sys/types.h>
44 #include <sys/ioctl.h>
46 #include <bsd/dev/disk_label.h>
52 int dr_bcount
; /* byte count for data transfers */
53 caddr_t dr_addr
; /* memory addr for data transfers */
54 struct timeval dr_exec_time
; /* execution time of operation */
57 * interpretation of cmdblk and errblk is driver specific.
59 char dr_cmdblk
[DR_CMDSIZE
];
60 char dr_errblk
[DR_ERRSIZE
];
64 vm_offset_t start
, end
;
65 boolean_t new_pageable
;
69 #define BAD_BLK_OFF 4 /* offset of bad blk tbl from label */
70 #define NBAD_BLK (12 * 1024 / sizeof (int))
72 struct bad_block
{ /* bad block table, sized to be 12KB */
73 int bad_blk
[NBAD_BLK
];
77 * sector bitmap states (2 bits per sector)
79 #define SB_UNTESTED 0 /* must be zero */
84 struct drive_info
{ /* info about drive hardware */
85 char di_name
[MAXDNMLEN
]; /* drive type name */
86 int di_label_blkno
[NLABELS
];/* label loc'ns in DEVICE SECTORS */
87 int di_devblklen
; /* device sector size */
88 int di_maxbcount
; /* max bytes per transfer request */
91 #define DS_STATSIZE 32
94 int s_ecccnt
; /* avg ECC corrections per sector */
95 int s_maxecc
; /* max ECC corrections observed */
98 * interpretation of s_stats is driver specific
100 char s_stats
[DS_STATSIZE
];
103 struct drive_location
{
104 char location
[ 128 ];
107 #define DKIOCGLABEL _IOR('d', 0,struct disk_label) // read label
108 #define DKIOCSLABEL _IOW('d', 1,struct disk_label) // write label
109 #define DKIOCGBITMAP _IO('d', 2) // read bitmap
110 #define DKIOCSBITMAP _IO('d', 3) // write bitmap
111 #define DKIOCREQ _IOWR('d', 4, struct disk_req) // cmd request
112 #define DKIOCINFO _IOR('d', 5, struct drive_info) // get drive info
113 #define DKIOCZSTATS _IO('d',7) // zero statistics
114 #define DKIOCGSTATS _IO('d', 8) // get statistics
115 #define DKIOCRESET _IO('d', 9) // reset disk
116 #define DKIOCGFLAGS _IOR('d', 11, int) // get driver flags
117 #define DKIOCSFLAGS _IOW('d', 12, int) // set driver flags
118 #define DKIOCSDCWIRE _IOW('d', 14, struct sdc_wire) // sdc wire memory
119 #define DKIOCSDCLOCK _IO('d', 15) // sdc lock
120 #define DKIOCSDCUNLOCK _IO('d', 16) // sdc unlock
121 #define DKIOCGFREEVOL _IOR('d', 17, int) // get free volume #
122 #define DKIOCGBBT _IO('d', 18) // read bad blk tbl
123 #define DKIOCSBBT _IO('d', 19) // write bad blk tbl
124 #define DKIOCMNOTIFY _IOW('d', 20, int) // message on insert
125 #define DKIOCEJECT _IO('d', 21) // eject disk
126 #define DKIOCPANELPRT _IOW('d', 22, int) // register Panel
128 #define DKIOCSFORMAT _IOW('d', 23, int) // set 'Formatted' flag
129 #define DKIOCGFORMAT _IOR('d', 23, int) // get 'Formatted' flag
130 #define DKIOCBLKSIZE _IOR('d', 24, int) // device sector size
131 #define DKIOCNUMBLKS _IOR('d', 25, int) // number of sectors
132 #define DKIOCCHECKINSERT _IO('d',26) // manually poll removable
134 #define DKIOCCANCELAUTOMOUNT _IOW('d',27, dev_t) // cancel automount request
135 #define DKIOCGLOCATION _IOR('d',28, struct drive_location) // arch dependent location descrip
136 #endif /* _BSD_DEV_DISK_ */