Annotation of 43BSDTahoe/man/man5/disklabel.5, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.