1 /* $NetBSD: disklbl.h,v 1.1 1996/01/16 15:15:52 leo Exp $ */ 2 3 /* 4 * Copyright (c) 1987, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the University of 18 * California, Berkeley and its contributors. 19 * 4. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 36 */ 37 38 #ifndef DISKLABEL_H 39 #define DISKLABEL_H 40 41 #define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ 42 43 struct disklabel { 44 u_int32_t d_magic; /* the magic number */ 45 u_int16_t d_type; /* drive type */ 46 u_int16_t d_subtype; /* controller/d_type specific */ 47 char d_typename[16]; /* type name, e.g. "eagle" */ 48 49 /* 50 * d_packname contains the pack identifier and is returned when 51 * the disklabel is read off the disk or in-core copy. 52 * d_boot0 and d_boot1 are the (optional) names of the 53 * primary (block 0) and secondary (block 1-15) bootstraps 54 * as found in /usr/mdec. These are returned when using 55 * getdiskbyname(3) to retrieve the values from /etc/disktab. 56 */ 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 68 /* disk geometry: */ 69 u_int32_t d_secsize; /* # of bytes per sector */ 70 u_int32_t d_nsectors; /* # of data sectors per track */ 71 u_int32_t d_ntracks; /* # of tracks per cylinder */ 72 u_int32_t d_ncylinders; /* # of data cylinders per unit */ 73 u_int32_t d_secpercyl; /* # of data sectors per cylinder */ 74 u_int32_t d_secperunit; /* # of data sectors per unit */ 75 76 /* 77 * Spares (bad sector replacements) below are not counted in 78 * d_nsectors or d_secpercyl. Spare sectors are assumed to 79 * be physical sectors which occupy space at the end of each 80 * track and/or cylinder. 81 */ 82 u_int16_t d_sparespertrack; /* # of spare sectors per track */ 83 u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ 84 /* 85 * Alternate cylinders include maintenance, replacement, configuration 86 * description areas, etc. 87 */ 88 u_int32_t d_acylinders; /* # of alt. cylinders per unit */ 89 90 /* hardware characteristics: */ 91 /* 92 * d_interleave, d_trackskew and d_cylskew describe perturbations 93 * in the media format used to compensate for a slow controller. 94 * Interleave is physical sector interleave, set up by the 95 * formatter or controller when formatting. When interleaving is 96 * in use, logically adjacent sectors are not physically 97 * contiguous, but instead are separated by some number of 98 * sectors. It is specified as the ratio of physical sectors 99 * traversed per logical sector. Thus an interleave of 1:1 100 * implies contiguous layout, while 2:1 implies that logical 101 * sector 0 is separated by one sector from logical sector 1. 102 * d_trackskew is the offset of sector 0 on track N relative to 103 * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew 104 * is the offset of sector 0 on cylinder N relative to sector 0 105 * on cylinder N-1. 106 */ 107 u_int16_t d_rpm; /* rotational speed */ 108 u_int16_t d_interleave; /* hardware sector interleave */ 109 u_int16_t d_trackskew; /* sector 0 skew, per track */ 110 u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ 111 u_int32_t d_headswitch; /* head switch time, usec */ 112 u_int32_t d_trkseek; /* track-to-track seek, usec */ 113 u_int32_t d_flags; /* generic flags */ 114 #define NDDATA 5 115 u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ 116 #define NSPARE 5 117 u_int32_t d_spare[NSPARE]; /* reserved for future use */ 118 u_int32_t d_magic2; /* the magic number (again) */ 119 u_int16_t d_checksum; /* xor of data incl. partitions */ 120 121 /* filesystem and partition information: */ 122 u_int16_t d_npartitions; /* number of partitions in following */ 123 u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ 124 u_int32_t d_sbsize; /* max size of fs superblock, bytes */ 125 struct partition { /* the partition table */ 126 u_int32_t p_size; /* number of sectors in partition */ 127 u_int32_t p_offset; /* starting sector */ 128 u_int32_t p_fsize; /* filesystem basic fragment size */ 129 u_int8_t p_fstype; /* filesystem type, see below */ 130 u_int8_t p_frag; /* filesystem fragments per block */ 131 union { 132 u_int16_t cpg; /* UFS: FS cylinders per group */ 133 u_int16_t sgs; /* LFS: FS segment shift */ 134 } __partition_u1; 135 #define p_cpg __partition_u1.cpg 136 #define p_sgs __partition_u1.sgs 137 } d_partitions[MAXPARTITIONS]; /* actually may be more */ 138 }; 139 140 #endif /* DISKLABEL_H */ 141