xref: /netbsd-src/sys/arch/atari/stand/tostools/libtos/disklbl.h (revision 95e1ffb15694e54f29f8baaa4232152b703c2a5a)
1*95e1ffb1Schristos /*	$NetBSD: disklbl.h,v 1.3 2005/12/11 12:17:00 christos Exp $	*/
27b23fbe2Sleo 
37b23fbe2Sleo /*
47b23fbe2Sleo  * Copyright (c) 1987, 1988, 1993
57b23fbe2Sleo  *	The Regents of the University of California.  All rights reserved.
67b23fbe2Sleo  *
77b23fbe2Sleo  * Redistribution and use in source and binary forms, with or without
87b23fbe2Sleo  * modification, are permitted provided that the following conditions
97b23fbe2Sleo  * are met:
107b23fbe2Sleo  * 1. Redistributions of source code must retain the above copyright
117b23fbe2Sleo  *    notice, this list of conditions and the following disclaimer.
127b23fbe2Sleo  * 2. Redistributions in binary form must reproduce the above copyright
137b23fbe2Sleo  *    notice, this list of conditions and the following disclaimer in the
147b23fbe2Sleo  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
167b23fbe2Sleo  *    may be used to endorse or promote products derived from this software
177b23fbe2Sleo  *    without specific prior written permission.
187b23fbe2Sleo  *
197b23fbe2Sleo  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
207b23fbe2Sleo  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
217b23fbe2Sleo  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
227b23fbe2Sleo  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
237b23fbe2Sleo  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
247b23fbe2Sleo  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
257b23fbe2Sleo  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
267b23fbe2Sleo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
277b23fbe2Sleo  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
287b23fbe2Sleo  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
297b23fbe2Sleo  * SUCH DAMAGE.
307b23fbe2Sleo  *
317b23fbe2Sleo  *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94
327b23fbe2Sleo  */
337b23fbe2Sleo 
347b23fbe2Sleo #ifndef DISKLABEL_H
357b23fbe2Sleo #define DISKLABEL_H
367b23fbe2Sleo 
377b23fbe2Sleo #define	DISKMAGIC	((u_int32_t)0x82564557)	/* The disk magic number */
387b23fbe2Sleo 
397b23fbe2Sleo struct disklabel {
407b23fbe2Sleo 	u_int32_t d_magic;		/* the magic number */
417b23fbe2Sleo 	u_int16_t d_type;		/* drive type */
427b23fbe2Sleo 	u_int16_t d_subtype;		/* controller/d_type specific */
437b23fbe2Sleo 	char	  d_typename[16];	/* type name, e.g. "eagle" */
447b23fbe2Sleo 
457b23fbe2Sleo 	/*
467b23fbe2Sleo 	 * d_packname contains the pack identifier and is returned when
477b23fbe2Sleo 	 * the disklabel is read off the disk or in-core copy.
487b23fbe2Sleo 	 * d_boot0 and d_boot1 are the (optional) names of the
497b23fbe2Sleo 	 * primary (block 0) and secondary (block 1-15) bootstraps
507b23fbe2Sleo 	 * as found in /usr/mdec.  These are returned when using
517b23fbe2Sleo 	 * getdiskbyname(3) to retrieve the values from /etc/disktab.
527b23fbe2Sleo 	 */
537b23fbe2Sleo 	union {
547b23fbe2Sleo 		char	un_d_packname[16];	/* pack identifier */
557b23fbe2Sleo 		struct {
567b23fbe2Sleo 			char *un_d_boot0;	/* primary bootstrap name */
577b23fbe2Sleo 			char *un_d_boot1;	/* secondary bootstrap name */
587b23fbe2Sleo 		} un_b;
597b23fbe2Sleo 	} d_un;
607b23fbe2Sleo #define	d_packname	d_un.un_d_packname
617b23fbe2Sleo #define	d_boot0		d_un.un_b.un_d_boot0
627b23fbe2Sleo #define	d_boot1		d_un.un_b.un_d_boot1
637b23fbe2Sleo 
647b23fbe2Sleo 			/* disk geometry: */
657b23fbe2Sleo 	u_int32_t d_secsize;		/* # of bytes per sector */
667b23fbe2Sleo 	u_int32_t d_nsectors;		/* # of data sectors per track */
677b23fbe2Sleo 	u_int32_t d_ntracks;		/* # of tracks per cylinder */
687b23fbe2Sleo 	u_int32_t d_ncylinders;		/* # of data cylinders per unit */
697b23fbe2Sleo 	u_int32_t d_secpercyl;		/* # of data sectors per cylinder */
707b23fbe2Sleo 	u_int32_t d_secperunit;		/* # of data sectors per unit */
717b23fbe2Sleo 
727b23fbe2Sleo 	/*
737b23fbe2Sleo 	 * Spares (bad sector replacements) below are not counted in
747b23fbe2Sleo 	 * d_nsectors or d_secpercyl.  Spare sectors are assumed to
757b23fbe2Sleo 	 * be physical sectors which occupy space at the end of each
767b23fbe2Sleo 	 * track and/or cylinder.
777b23fbe2Sleo 	 */
787b23fbe2Sleo 	u_int16_t d_sparespertrack;	/* # of spare sectors per track */
797b23fbe2Sleo 	u_int16_t d_sparespercyl;	/* # of spare sectors per cylinder */
807b23fbe2Sleo 	/*
817b23fbe2Sleo 	 * Alternate cylinders include maintenance, replacement, configuration
827b23fbe2Sleo 	 * description areas, etc.
837b23fbe2Sleo 	 */
847b23fbe2Sleo 	u_int32_t d_acylinders;		/* # of alt. cylinders per unit */
857b23fbe2Sleo 
867b23fbe2Sleo 			/* hardware characteristics: */
877b23fbe2Sleo 	/*
887b23fbe2Sleo 	 * d_interleave, d_trackskew and d_cylskew describe perturbations
897b23fbe2Sleo 	 * in the media format used to compensate for a slow controller.
907b23fbe2Sleo 	 * Interleave is physical sector interleave, set up by the
917b23fbe2Sleo 	 * formatter or controller when formatting.  When interleaving is
927b23fbe2Sleo 	 * in use, logically adjacent sectors are not physically
937b23fbe2Sleo 	 * contiguous, but instead are separated by some number of
947b23fbe2Sleo 	 * sectors.  It is specified as the ratio of physical sectors
957b23fbe2Sleo 	 * traversed per logical sector.  Thus an interleave of 1:1
967b23fbe2Sleo 	 * implies contiguous layout, while 2:1 implies that logical
977b23fbe2Sleo 	 * sector 0 is separated by one sector from logical sector 1.
987b23fbe2Sleo 	 * d_trackskew is the offset of sector 0 on track N relative to
997b23fbe2Sleo 	 * sector 0 on track N-1 on the same cylinder.  Finally, d_cylskew
1007b23fbe2Sleo 	 * is the offset of sector 0 on cylinder N relative to sector 0
1017b23fbe2Sleo 	 * on cylinder N-1.
1027b23fbe2Sleo 	 */
1037b23fbe2Sleo 	u_int16_t d_rpm;		/* rotational speed */
1047b23fbe2Sleo 	u_int16_t d_interleave;		/* hardware sector interleave */
1057b23fbe2Sleo 	u_int16_t d_trackskew;		/* sector 0 skew, per track */
1067b23fbe2Sleo 	u_int16_t d_cylskew;		/* sector 0 skew, per cylinder */
1077b23fbe2Sleo 	u_int32_t d_headswitch;		/* head switch time, usec */
1087b23fbe2Sleo 	u_int32_t d_trkseek;		/* track-to-track seek, usec */
1097b23fbe2Sleo 	u_int32_t d_flags;		/* generic flags */
1107b23fbe2Sleo #define	NDDATA 5
1117b23fbe2Sleo 	u_int32_t d_drivedata[NDDATA];	/* drive-type specific information */
1127b23fbe2Sleo #define	NSPARE 5
1137b23fbe2Sleo 	u_int32_t d_spare[NSPARE];	/* reserved for future use */
1147b23fbe2Sleo 	u_int32_t d_magic2;		/* the magic number (again) */
1157b23fbe2Sleo 	u_int16_t d_checksum;		/* xor of data incl. partitions */
1167b23fbe2Sleo 
1177b23fbe2Sleo 			/* filesystem and partition information: */
1187b23fbe2Sleo 	u_int16_t d_npartitions;	/* number of partitions in following */
1197b23fbe2Sleo 	u_int32_t d_bbsize;		/* size of boot area at sn0, bytes */
1207b23fbe2Sleo 	u_int32_t d_sbsize;		/* max size of fs superblock, bytes */
1217b23fbe2Sleo 	struct	partition {		/* the partition table */
1227b23fbe2Sleo 		u_int32_t p_size;	/* number of sectors in partition */
1237b23fbe2Sleo 		u_int32_t p_offset;	/* starting sector */
1247b23fbe2Sleo 		u_int32_t p_fsize;	/* filesystem basic fragment size */
1257b23fbe2Sleo 		u_int8_t p_fstype;	/* filesystem type, see below */
1267b23fbe2Sleo 		u_int8_t p_frag;	/* filesystem fragments per block */
1277b23fbe2Sleo 		union {
1287b23fbe2Sleo 			u_int16_t cpg;	/* UFS: FS cylinders per group */
1297b23fbe2Sleo 			u_int16_t sgs;	/* LFS: FS segment shift */
1307b23fbe2Sleo 		} __partition_u1;
1317b23fbe2Sleo #define	p_cpg	__partition_u1.cpg
1327b23fbe2Sleo #define	p_sgs	__partition_u1.sgs
1337b23fbe2Sleo 	} d_partitions[MAXPARTITIONS];	/* actually may be more */
1347b23fbe2Sleo };
1357b23fbe2Sleo 
1367b23fbe2Sleo #endif /* DISKLABEL_H */
137