]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/disk.h
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* @(#)disk.h 1.0 08/29/87 (c) 1987 NeXT */
27 #ifndef _BSD_DEV_DISK_
28 #define _BSD_DEV_DISK_
32 #include <sys/appleapiopts.h>
33 #include <mach/machine/vm_types.h>
34 #include <mach/machine/boolean.h>
35 #include <sys/types.h>
36 #include <sys/ioctl.h>
38 #include <dev/disk_label.h>
41 * USE <sys/disk.h> INSTEAD (NOTE: DKIOCGETBLOCKCOUNT -> DKIOCGETBLOCKCOUNT32)
44 #ifdef __APPLE_API_OBSOLETE
50 int dr_bcount
; /* byte count for data transfers */
51 caddr_t dr_addr
; /* memory addr for data transfers */
52 struct timeval dr_exec_time
; /* execution time of operation */
55 * interpretation of cmdblk and errblk is driver specific.
57 char dr_cmdblk
[DR_CMDSIZE
];
58 char dr_errblk
[DR_ERRSIZE
];
62 vm_offset_t start
, end
;
63 boolean_t new_pageable
;
67 #define BAD_BLK_OFF 4 /* offset of bad blk tbl from label */
68 #define NBAD_BLK (12 * 1024 / sizeof (int))
70 struct bad_block
{ /* bad block table, sized to be 12KB */
71 int bad_blk
[NBAD_BLK
];
75 * sector bitmap states (2 bits per sector)
77 #define SB_UNTESTED 0 /* must be zero */
82 struct drive_info
{ /* info about drive hardware */
83 char di_name
[MAXDNMLEN
]; /* drive type name */
84 int di_label_blkno
[NLABELS
];/* label loc'ns in DEVICE SECTORS */
85 int di_devblklen
; /* device sector size */
86 int di_maxbcount
; /* max bytes per transfer request */
89 #define DS_STATSIZE 32
92 int s_ecccnt
; /* avg ECC corrections per sector */
93 int s_maxecc
; /* max ECC corrections observed */
96 * interpretation of s_stats is driver specific
98 char s_stats
[DS_STATSIZE
];
101 struct drive_location
{
102 char location
[ 128 ];
105 #define DKIOCGLABEL _IOR('d', 0,struct disk_label) /* read label */
106 #define DKIOCSLABEL _IOW('d', 1,struct disk_label) /* write label */
107 #define DKIOCGBITMAP _IO('d', 2) /* read bitmap */
108 #define DKIOCSBITMAP _IO('d', 3) /* write bitmap */
109 #define DKIOCREQ _IOWR('d', 4, struct disk_req) /* cmd request */
110 #define DKIOCINFO _IOR('d', 5, struct drive_info) /* get drive info */
111 #define DKIOCZSTATS _IO('d',7) /* zero statistics */
112 #define DKIOCGSTATS _IO('d', 8) /* get statistics */
113 #define DKIOCRESET _IO('d', 9) /* reset disk */
114 #define DKIOCGFLAGS _IOR('d', 11, int) /* get driver flags */
115 #define DKIOCSFLAGS _IOW('d', 12, int) /* set driver flags */
116 #define DKIOCSDCWIRE _IOW('d', 14, struct sdc_wire) /* sdc wire memory */
117 #define DKIOCSDCLOCK _IO('d', 15) /* sdc lock */
118 #define DKIOCSDCUNLOCK _IO('d', 16) /* sdc unlock */
119 #define DKIOCGFREEVOL _IOR('d', 17, int) /* get free volume # */
120 #define DKIOCGBBT _IO('d', 18) /* read bad blk tbl */
121 #define DKIOCSBBT _IO('d', 19) /* write bad blk tbl */
122 #define DKIOCMNOTIFY _IOW('d', 20, int) /* message on insert */
123 #define DKIOCEJECT _IO('d', 21) /* eject disk */
124 #define DKIOCPANELPRT _IOW('d', 22, int) /* register Panel */
126 #define DKIOCSFORMAT _IOW('d', 23, int) /* set 'Formatted' flag */
127 #define DKIOCGFORMAT _IOR('d', 23, int) /* get 'Formatted' flag */
128 #define DKIOCBLKSIZE _IOR('d', 24, int) /* device sector size */
129 #define DKIOCNUMBLKS _IOR('d', 25, int) /* number of sectors */
130 #define DKIOCCHECKINSERT _IO('d',26) /* manually poll removable */
132 #define DKIOCCANCELAUTOMOUNT _IOW('d',27, dev_t) /* cancel automount request */
133 #define DKIOCGLOCATION _IOR('d',28, struct drive_location) /* arch dependent location descrip */
134 #define DKIOCSETBLOCKSIZE _IOW('d', 24, int) /* set media's preferred sector size */
135 #define DKIOCGETBLOCKSIZE DKIOCBLKSIZE /* get media's preferred sector size */
136 #define DKIOCGETBLOCKCOUNT32 DKIOCNUMBLKS /* get media's sector count */
137 #define DKIOCGETBLOCKCOUNT64 _IOR('d', 25, u_int64_t) /* get media's sector count */
138 #define DKIOCGETLOCATION DKIOCGLOCATION /* get media's location description */
139 #define DKIOCISFORMATTED DKIOCGFORMAT /* is media formatted? */
140 #define DKIOCISWRITABLE _IOR('d', 29, int) /* is media writable? */
142 #define DKIOCGETMAXBLOCKCOUNTREAD _IOR('d', 64, u_int64_t) /* get device's maximum block count for read requests */
143 #define DKIOCGETMAXBLOCKCOUNTWRITE _IOR('d', 65, u_int64_t) /* get device's maximum block count for write requests */
144 #define DKIOCGETMAXSEGMENTCOUNTREAD _IOR('d', 66, u_int64_t) /* get device's maximum physical segment count for read buffers */
145 #define DKIOCGETMAXSEGMENTCOUNTWRITE _IOR('d', 67, u_int64_t) /* get device's maximum physical segment count for write buffers */
147 #endif /* __APPLE_API_OBSOLETE */
149 #endif /* _SYS_DISK_H_ */
150 #endif /* _BSD_DEV_DISK_ */