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