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