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