|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University ! 4: * All Rights Reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software and its ! 7: * documentation is hereby granted, provided that both the copyright ! 8: * notice and this permission notice appear in all copies of the ! 9: * software, derivative works or modified versions, and any portions ! 10: * thereof, and that both notices appear in supporting documentation. ! 11: * ! 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 15: * ! 16: * Carnegie Mellon requests users of this software to return to ! 17: * ! 18: * Software Distribution Coordinator or [email protected] ! 19: * School of Computer Science ! 20: * Carnegie Mellon University ! 21: * Pittsburgh PA 15213-3890 ! 22: * ! 23: * any improvements or extensions that they make and grant Carnegie Mellon ! 24: * the rights to redistribute these changes. ! 25: */ ! 26: /* ! 27: * Copyright (c) 1987, 1988 Regents of the University of California. ! 28: * All rights reserved. ! 29: * ! 30: * Redistribution and use in source and binary forms are permitted ! 31: * provided that the above copyright notice and this paragraph are ! 32: * duplicated in all such forms and that any documentation, ! 33: * advertising materials, and other materials related to such ! 34: * distribution and use acknowledge that the software was developed ! 35: * by the University of California, Berkeley. The name of the ! 36: * University may not be used to endorse or promote products derived ! 37: * from this software without specific prior written permission. ! 38: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 39: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 40: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 41: * ! 42: * @(#)disklabel.h 7.10 (Berkeley) 6/27/88 ! 43: */ ! 44: ! 45: #ifndef _DISK_STATUS_H_ ! 46: #define _DISK_STATUS_H_ ! 47: ! 48: /* ! 49: * Each disk has a label which includes information about the hardware ! 50: * disk geometry, filesystem partitions, and drive specific information. ! 51: * The label is in block 0 or 1, possibly offset from the beginning ! 52: * to leave room for a bootstrap, etc. ! 53: */ ! 54: ! 55: #define LABELSECTOR 0 /* sector containing label */ ! 56: #define LABELOFFSET 64 /* offset of label in sector */ ! 57: #define DISKMAGIC ((unsigned int) 0x82564557U) /* The disk magic number */ ! 58: #ifndef MAXPARTITIONS ! 59: #define MAXPARTITIONS 8 ! 60: #endif ! 61: ! 62: ! 63: #ifndef LOCORE ! 64: struct disklabel { ! 65: unsigned int d_magic; /* the magic number */ ! 66: short d_type; /* drive type */ ! 67: short d_subtype; /* controller/d_type specific */ ! 68: char d_typename[16]; /* type name, e.g. "eagle" */ ! 69: /* ! 70: * d_packname contains the pack identifier and is returned when ! 71: * the disklabel is read off the disk or in-core copy. ! 72: * d_boot0 and d_boot1 are the (optional) names of the ! 73: * primary (block 0) and secondary (block 1-15) bootstraps ! 74: * as found in /usr/mdec. These are returned when using ! 75: * getdiskbyname(3) to retrieve the values from /etc/disktab. ! 76: */ ! 77: #if defined(MACH_KERNEL) || defined(STANDALONE) ! 78: char d_packname[16]; /* pack identifier */ ! 79: #else ! 80: union { ! 81: char un_d_packname[16]; /* pack identifier */ ! 82: struct { ! 83: char *un_d_boot0; /* primary bootstrap name */ ! 84: char *un_d_boot1; /* secondary bootstrap name */ ! 85: } un_b; ! 86: } d_un; ! 87: #define d_packname d_un.un_d_packname ! 88: #define d_boot0 d_un.un_b.un_d_boot0 ! 89: #define d_boot1 d_un.un_b.un_d_boot1 ! 90: #endif /* ! MACH_KERNEL or STANDALONE */ ! 91: /* disk geometry: */ ! 92: unsigned int d_secsize; /* # of bytes per sector */ ! 93: unsigned int d_nsectors; /* # of data sectors per track */ ! 94: unsigned int d_ntracks; /* # of tracks per cylinder */ ! 95: unsigned int d_ncylinders; /* # of data cylinders per unit */ ! 96: unsigned int d_secpercyl; /* # of data sectors per cylinder */ ! 97: unsigned int d_secperunit; /* # of data sectors per unit */ ! 98: /* ! 99: * Spares (bad sector replacements) below ! 100: * are not counted in d_nsectors or d_secpercyl. ! 101: * Spare sectors are assumed to be physical sectors ! 102: * which occupy space at the end of each track and/or cylinder. ! 103: */ ! 104: unsigned short d_sparespertrack; /* # of spare sectors per track */ ! 105: unsigned short d_sparespercyl; /* # of spare sectors per cylinder */ ! 106: /* ! 107: * Alternate cylinders include maintenance, replacement, ! 108: * configuration description areas, etc. ! 109: */ ! 110: unsigned int d_acylinders; /* # of alt. cylinders per unit */ ! 111: ! 112: /* hardware characteristics: */ ! 113: /* ! 114: * d_interleave, d_trackskew and d_cylskew describe perturbations ! 115: * in the media format used to compensate for a slow controller. ! 116: * Interleave is physical sector interleave, set up by the formatter ! 117: * or controller when formatting. When interleaving is in use, ! 118: * logically adjacent sectors are not physically contiguous, ! 119: * but instead are separated by some number of sectors. ! 120: * It is specified as the ratio of physical sectors traversed ! 121: * per logical sector. Thus an interleave of 1:1 implies contiguous ! 122: * layout, while 2:1 implies that logical sector 0 is separated ! 123: * by one sector from logical sector 1. ! 124: * d_trackskew is the offset of sector 0 on track N ! 125: * relative to sector 0 on track N-1 on the same cylinder. ! 126: * Finally, d_cylskew is the offset of sector 0 on cylinder N ! 127: * relative to sector 0 on cylinder N-1. ! 128: */ ! 129: unsigned short d_rpm; /* rotational speed */ ! 130: unsigned short d_interleave; /* hardware sector interleave */ ! 131: unsigned short d_trackskew; /* sector 0 skew, per track */ ! 132: unsigned short d_cylskew; /* sector 0 skew, per cylinder */ ! 133: unsigned int d_headswitch; /* head switch time, usec */ ! 134: unsigned int d_trkseek; /* track-to-track seek, usec */ ! 135: unsigned int d_flags; /* generic flags */ ! 136: #define NDDATA 5 ! 137: unsigned int d_drivedata[NDDATA]; /* drive-type specific information */ ! 138: #define NSPARE 5 ! 139: unsigned int d_spare[NSPARE]; /* reserved for future use */ ! 140: unsigned int d_magic2; /* the magic number (again) */ ! 141: unsigned short d_checksum; /* xor of data incl. partitions */ ! 142: ! 143: /* filesystem and partition information: */ ! 144: unsigned short d_npartitions; /* number of partitions in following */ ! 145: unsigned int d_bbsize; /* size of boot area at sn0, bytes */ ! 146: unsigned int d_sbsize; /* max size of fs superblock, bytes */ ! 147: struct partition { /* the partition table */ ! 148: unsigned int p_size; /* number of sectors in partition */ ! 149: unsigned int p_offset; /* starting sector */ ! 150: unsigned int p_fsize; /* filesystem basic fragment size */ ! 151: unsigned char p_fstype; /* filesystem type, see below */ ! 152: unsigned char p_frag; /* filesystem fragments per block */ ! 153: unsigned short p_cpg; /* filesystem cylinders per group */ ! 154: } d_partitions[MAXPARTITIONS+1]; /* actually may be more */ ! 155: ! 156: #if defined(alpha) && defined(MACH_KERNEL) ! 157: /* ! 158: * Disgusting hack. If this structure contains a pointer, ! 159: * as it does for non-kernel, then the compiler rounds ! 160: * the size to make it pointer-sized properly (arrays of..). ! 161: * But if I define the pointer for the kernel then instances ! 162: * of this structure better be aligned otherwise picking ! 163: * up a short might be done by too-smart compilers (GCC) with ! 164: * a load-long instruction expecting the short to be aligned. ! 165: * I bet the OSF folks stomped into this too, since they use ! 166: * the same disgusting hack below.. [whatelse can I do ??] ! 167: */ ! 168: int bugfix; ! 169: #endif ! 170: }; ! 171: #else LOCORE ! 172: /* ! 173: * offsets for asm boot files. ! 174: */ ! 175: .set d_secsize,40 ! 176: .set d_nsectors,44 ! 177: .set d_ntracks,48 ! 178: .set d_ncylinders,52 ! 179: .set d_secpercyl,56 ! 180: .set d_secperunit,60 ! 181: .set d_end_,276 /* size of disk label */ ! 182: #endif LOCORE ! 183: ! 184: /* d_type values: */ ! 185: #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ ! 186: #define DTYPE_MSCP 2 /* MSCP */ ! 187: #define DTYPE_DEC 3 /* other DEC (rk, rl) */ ! 188: #define DTYPE_SCSI 4 /* SCSI */ ! 189: #define DTYPE_ESDI 5 /* ESDI interface */ ! 190: #define DTYPE_ST506 6 /* ST506 etc. */ ! 191: #define DTYPE_FLOPPY 10 /* floppy */ ! 192: ! 193: #ifdef DKTYPENAMES ! 194: static char *dktypenames[] = { ! 195: "unknown", ! 196: "SMD", ! 197: "MSCP", ! 198: "old DEC", ! 199: "SCSI", ! 200: "ESDI", ! 201: "type 6", ! 202: "type 7", ! 203: "type 8", ! 204: "type 9", ! 205: "floppy", ! 206: 0 ! 207: }; ! 208: #define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) ! 209: #endif ! 210: ! 211: /* ! 212: * Filesystem type and version. ! 213: * Used to interpret other filesystem-specific ! 214: * per-partition information. ! 215: */ ! 216: #define FS_UNUSED 0 /* unused */ ! 217: #define FS_SWAP 1 /* swap */ ! 218: #define FS_V6 2 /* Sixth Edition */ ! 219: #define FS_V7 3 /* Seventh Edition */ ! 220: #define FS_SYSV 4 /* System V */ ! 221: #define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ ! 222: #define FS_V8 6 /* Eighth Edition, 4K blocks */ ! 223: #define FS_BSDFFS 7 /* 4.2BSD fast file system */ ! 224: #define FS_LINUXFS 8 /* Linux file system */ ! 225: ! 226: #ifdef DKTYPENAMES ! 227: static char *fstypenames[] = { ! 228: "unused", ! 229: "swap", ! 230: "Version 6", ! 231: "Version 7", ! 232: "System V", ! 233: "4.1BSD", ! 234: "Eighth Edition", ! 235: "4.2BSD", ! 236: "Linux", ! 237: 0 ! 238: }; ! 239: #define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) ! 240: #endif ! 241: ! 242: /* ! 243: * flags shared by various drives: ! 244: */ ! 245: #define D_REMOVABLE 0x01 /* removable media */ ! 246: #define D_ECC 0x02 /* supports ECC */ ! 247: #define D_BADSECT 0x04 /* supports bad sector forw. */ ! 248: #define D_RAMDISK 0x08 /* disk emulator */ ! 249: #define D_CHAIN 0x10 /* can do back-back transfers */ ! 250: ! 251: /* ! 252: * Drive data for SMD. ! 253: */ ! 254: #define d_smdflags d_drivedata[0] ! 255: #define D_SSE 0x1 /* supports skip sectoring */ ! 256: #define d_mindist d_drivedata[1] ! 257: #define d_maxdist d_drivedata[2] ! 258: #define d_sdist d_drivedata[3] ! 259: ! 260: /* ! 261: * Drive data for ST506. ! 262: */ ! 263: #define d_precompcyl d_drivedata[0] ! 264: #define d_gap3 d_drivedata[1] /* used only when formatting */ ! 265: ! 266: /* ! 267: * IBM controller info (d_precompcyl used, too) ! 268: */ ! 269: #define d_step d_drivedata[2] ! 270: ! 271: #ifndef LOCORE ! 272: /* ! 273: * Structure used to perform a format ! 274: * or other raw operation, returning data ! 275: * and/or register values. ! 276: * Register identification and format ! 277: * are device- and driver-dependent. ! 278: */ ! 279: struct format_op { ! 280: char *df_buf; ! 281: int df_count; /* value-result */ ! 282: recnum_t df_startblk; ! 283: int df_reg[8]; /* result */ ! 284: }; ! 285: ! 286: /* ! 287: * Disk-specific ioctls. ! 288: */ ! 289: /* get and set disklabel; DIOCGPART used internally */ ! 290: #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ ! 291: #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ ! 292: #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ ! 293: ! 294: /* do format operation, read or write */ ! 295: #define DIOCRFORMAT _IOWR('d', 105, struct format_op) ! 296: #define DIOCWFORMAT _IOWR('d', 106, struct format_op) ! 297: ! 298: #define DIOCSSTEP _IOW('d', 107, int) /* set step rate */ ! 299: #define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */ ! 300: #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ ! 301: ! 302: #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ ! 303: ! 304: #endif LOCORE ! 305: ! 306: #endif /* _DISK_STATUS_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.