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