Annotation of OSKit-Mach/include/device/disk_status.h, revision 1.1

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

unix.superglobalmegacorp.com

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