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