]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/disk.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* @(#)disk.h 1.0 08/29/87 (c) 1987 NeXT */
26 * 28-Mar-92 Doug Mitchell
27 * Moved disk_label struct to <bsd/dev/disk_label.h>.
29 * 22-May-91 Gregg Kellogg (gk) at NeXT
30 * Split out public interface.
32 * 20-Jul-90 Doug Mitchell
33 * Added DKIOCSFORMAT, DKIOCGFORMAT
35 * 16-Apr-90 Doug Mitchell at NeXT
36 * Added DKIOCPANELPRT.
38 * 25-Mar-90 John Seamons (jks) at NeXT
39 * Removed obsolete DKIOCNOTIFY and DKIOCINSERT.
41 * 23-Mar-90 Doug Mitchell
44 * 14-Feb-90 Doug Mitchell at NeXT
47 * 16-Mar-88 John Seamons (jks) at NeXT
48 * Cleaned up to support standard disk label definitions.
50 * 24-Feb-88 Mike DeMoney (mike) at NeXT
51 * Added defines for dl_bootfile and dl_boot0_blkno.
52 * Reduced NBAD to allow for these entries in disktab.
54 * 29-Aug-87 John Seamons (jks) at NeXT
59 #ifndef _BSD_DEV_DISK_
60 #define _BSD_DEV_DISK_
62 #include <mach/machine/vm_types.h>
63 #include <mach/machine/boolean.h>
64 #include <sys/types.h>
65 #include <sys/ioctl.h>
67 #include <dev/disk_label.h>
73 int dr_bcount
; /* byte count for data transfers */
74 caddr_t dr_addr
; /* memory addr for data transfers */
75 struct timeval dr_exec_time
; /* execution time of operation */
78 * interpretation of cmdblk and errblk is driver specific.
80 char dr_cmdblk
[DR_CMDSIZE
];
81 char dr_errblk
[DR_ERRSIZE
];
85 vm_offset_t start
, end
;
86 boolean_t new_pageable
;
90 #define BAD_BLK_OFF 4 /* offset of bad blk tbl from label */
91 #define NBAD_BLK (12 * 1024 / sizeof (int))
93 struct bad_block
{ /* bad block table, sized to be 12KB */
94 int bad_blk
[NBAD_BLK
];
98 * sector bitmap states (2 bits per sector)
100 #define SB_UNTESTED 0 /* must be zero */
105 struct drive_info
{ /* info about drive hardware */
106 char di_name
[MAXDNMLEN
]; /* drive type name */
107 int di_label_blkno
[NLABELS
];/* label loc'ns in DEVICE SECTORS */
108 int di_devblklen
; /* device sector size */
109 int di_maxbcount
; /* max bytes per transfer request */
112 #define DS_STATSIZE 32
115 int s_ecccnt
; /* avg ECC corrections per sector */
116 int s_maxecc
; /* max ECC corrections observed */
119 * interpretation of s_stats is driver specific
121 char s_stats
[DS_STATSIZE
];
124 struct drive_location
{
125 char location
[ 128 ];
128 #define DKIOCGLABEL _IOR('d', 0,struct disk_label) /* read label */
129 #define DKIOCSLABEL _IOW('d', 1,struct disk_label) /* write label */
130 #define DKIOCGBITMAP _IO('d', 2) /* read bitmap */
131 #define DKIOCSBITMAP _IO('d', 3) /* write bitmap */
132 #define DKIOCREQ _IOWR('d', 4, struct disk_req) /* cmd request */
133 #define DKIOCINFO _IOR('d', 5, struct drive_info) /* get drive info */
134 #define DKIOCZSTATS _IO('d',7) /* zero statistics */
135 #define DKIOCGSTATS _IO('d', 8) /* get statistics */
136 #define DKIOCRESET _IO('d', 9) /* reset disk */
137 #define DKIOCGFLAGS _IOR('d', 11, int) /* get driver flags */
138 #define DKIOCSFLAGS _IOW('d', 12, int) /* set driver flags */
139 #define DKIOCSDCWIRE _IOW('d', 14, struct sdc_wire) /* sdc wire memory */
140 #define DKIOCSDCLOCK _IO('d', 15) /* sdc lock */
141 #define DKIOCSDCUNLOCK _IO('d', 16) /* sdc unlock */
142 #define DKIOCGFREEVOL _IOR('d', 17, int) /* get free volume # */
143 #define DKIOCGBBT _IO('d', 18) /* read bad blk tbl */
144 #define DKIOCSBBT _IO('d', 19) /* write bad blk tbl */
145 #define DKIOCMNOTIFY _IOW('d', 20, int) /* message on insert */
146 #define DKIOCEJECT _IO('d', 21) /* eject disk */
147 #define DKIOCPANELPRT _IOW('d', 22, int) /* register Panel */
149 #define DKIOCSFORMAT _IOW('d', 23, int) /* set 'Formatted' flag */
150 #define DKIOCGFORMAT _IOR('d', 23, int) /* get 'Formatted' flag */
151 #define DKIOCBLKSIZE _IOR('d', 24, int) /* device sector size */
152 #define DKIOCNUMBLKS _IOR('d', 25, int) /* number of sectors */
153 #define DKIOCCHECKINSERT _IO('d',26) /* manually poll removable */
155 #define DKIOCCANCELAUTOMOUNT _IOW('d',27, dev_t) /* cancel automount request */
156 #define DKIOCGLOCATION _IOR('d',28, struct drive_location) /* arch dependent location descrip */
157 #define DKIOCSETBLOCKSIZE _IOW('d', 24, int) /* set media's preferred sector size */
158 #define DKIOCGETBLOCKSIZE DKIOCBLKSIZE /* get media's preferred sector size */
159 #define DKIOCGETBLOCKCOUNT DKIOCNUMBLKS /* get media's sector count */
160 #define DKIOCGETLOCATION DKIOCGLOCATION /* get media's location description */
161 #define DKIOCISFORMATTED DKIOCGFORMAT /* is media formatted? */
162 #define DKIOCISWRITABLE _IOR('d', 29, int) /* is media writable? */
163 #endif /* _BSD_DEV_DISK_ */