disklabel.h revision 1.1 1 1.1 dbj /* $NetBSD: disklabel.h,v 1.1 1998/06/09 07:53:05 dbj Exp $ */
2 1.1 dbj /*
3 1.1 dbj * Copyright (c) 1994 Rolf Grossmann
4 1.1 dbj * All rights reserved.
5 1.1 dbj *
6 1.1 dbj * Redistribution and use in source and binary forms, with or without
7 1.1 dbj * modification, are permitted provided that the following conditions
8 1.1 dbj * are met:
9 1.1 dbj * 1. Redistributions of source code must retain the above copyright
10 1.1 dbj * notice, this list of conditions and the following disclaimer.
11 1.1 dbj * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 dbj * notice, this list of conditions and the following disclaimer in the
13 1.1 dbj * documentation and/or other materials provided with the distribution.
14 1.1 dbj * 3. All advertising materials mentioning features or use of this software
15 1.1 dbj * must display the following acknowledgement:
16 1.1 dbj * This product includes software developed by Rolf Grossmann.
17 1.1 dbj * 4. The name of the author may not be used to endorse or promote products
18 1.1 dbj * derived from this software without specific prior written permission
19 1.1 dbj *
20 1.1 dbj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 dbj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 dbj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 dbj * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 dbj * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 dbj * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 dbj * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 dbj * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 dbj * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 dbj * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 dbj */
31 1.1 dbj
32 1.1 dbj #ifndef _MACHINE_DISKLABEL_H_
33 1.1 dbj #define _MACHINE_DISKLABEL_H_
34 1.1 dbj
35 1.1 dbj #define LABELSECTOR 0 /* sector containing label */
36 1.1 dbj #define LABELOFFSET 0 /* offset of label in sector */
37 1.1 dbj #define LABELSIZE 8192 /* size of label */
38 1.1 dbj #define MAXPARTITIONS 8 /* number of partitions */
39 1.1 dbj #define RAW_PART 2 /* raw partition: xx?c */
40 1.1 dbj
41 1.1 dbj #define CD_V1 0x4e655854 /* version #1: "NeXT" */
42 1.1 dbj #define CD_V2 0x646c5632 /* version #2: "dlV2" */
43 1.1 dbj #define CD_V3 0x646c5633 /* version #3: "dlV3" */
44 1.1 dbj #define IS_DISKLABEL(l) ((l)->cd_version == CD_V1 || (l)->cd_version == CD_V2 \
45 1.1 dbj || (l)->cd_version == CD_V3)
46 1.1 dbj
47 1.1 dbj /* XXX should we really size all this stuff this way ? */
48 1.1 dbj #define CPULBLLEN 24
49 1.1 dbj #define MAXDNMLEN 24
50 1.1 dbj #define MAXTYPLEN 24
51 1.1 dbj #define MAXBFLEN 24
52 1.1 dbj #define MAXHNLEN 32
53 1.1 dbj #define MAXMPTLEN 16
54 1.1 dbj #define MAXFSTLEN 8
55 1.1 dbj
56 1.1 dbj /* The disklabel the way it is on the disk */
57 1.1 dbj struct cpu_disklabel {
58 1.1 dbj int cd_version; /* label version */
59 1.1 dbj int cd_label_blkno; /* block # of this label */
60 1.1 dbj int cd_size; /* size of media area (sectors) */
61 1.1 dbj char cd_label[CPULBLLEN]; /* disk name (label) */
62 1.1 dbj u_int cd_flags; /* flags */
63 1.1 dbj #define CD_UNINIT 0x80000000 /* label is uninitialized */
64 1.1 dbj u_int cd_tag; /* volume tag */
65 1.1 dbj char cd_name[MAXDNMLEN]; /* drive (hardware) name */
66 1.1 dbj char cd_type[MAXTYPLEN]; /* drive type */
67 1.1 dbj int cd_secsize; /* # of bytes per sector */
68 1.1 dbj int cd_ntracks; /* # of tracks per cylinder */
69 1.1 dbj int cd_nsectors; /* # of data sectors per track */
70 1.1 dbj int cd_ncylinders; /* # of data cylinders per unit */
71 1.1 dbj int cd_rpm; /* rotational speed */
72 1.1 dbj short cd_front; /* # of sectors in "front porch" */
73 1.1 dbj short cd_back; /* # of sectors in "back porch" */
74 1.1 dbj short cd_ngroups; /* # of alt groups */
75 1.1 dbj short cd_ag_size; /* alt group size (sectors) */
76 1.1 dbj short cd_ag_alts; /* alternate sectors / alt group */
77 1.1 dbj short cd_ag_off; /* sector offset to first alternate */
78 1.1 dbj int cd_boot_blkno[2]; /* boot program locations */
79 1.1 dbj char cd_kernel[MAXBFLEN]; /* default kernel name */
80 1.1 dbj char cd_hostname[MAXHNLEN]; /* host name (usu. where disk was labeled) */
81 1.1 dbj char cd_rootpartition; /* root partition letter e.g. 'a' */
82 1.1 dbj char cd_rwpartition; /* r/w partition letter e.g. 'b' */
83 1.1 dbj struct cpu_partition {
84 1.1 dbj int cp_offset; /* starting sector */
85 1.1 dbj int cp_size; /* number of sectors in partition */
86 1.1 dbj short cp_bsize; /* block size in bytes */
87 1.1 dbj short cp_fsize; /* filesystem basic fragment size */
88 1.1 dbj char cp_opt; /* optimization type: 's'pace/'t'ime */
89 1.1 dbj short cp_cpg; /* filesystem cylinders per group */
90 1.1 dbj short cp_density; /* bytes per inode density */
91 1.1 dbj char cp_minfree; /* minfree (%) */
92 1.1 dbj short cp_reserved; /* no useful data here */
93 1.1 dbj char cp_mountpt[MAXMPTLEN];/* default/standard mount point */
94 1.1 dbj char cp_automnt; /* auto-mount when inserted */
95 1.1 dbj char cp_res2; /* alignment byte */
96 1.1 dbj char cp_type[MAXFSTLEN]; /* file system type name */
97 1.1 dbj } cd_partitions[MAXPARTITIONS];
98 1.1 dbj
99 1.1 dbj union {
100 1.1 dbj u_short CD_v3_checksum; /* label version 3 checksum */
101 1.1 dbj #define NBAD 1670 /* sized to make label ~= 8KB */
102 1.1 dbj int CD_bad[NBAD]; /* block number that is bad */
103 1.1 dbj } cd_un;
104 1.1 dbj #define cd_v3_checksum cd_un.CD_v3_checksum
105 1.1 dbj #define cd_bad cd_un.CD_bad
106 1.1 dbj u_short cd_checksum; /* label version 1 or 2 checksum */
107 1.1 dbj };
108 1.1 dbj
109 1.1 dbj #endif /* _MACHINE_DISKLABEL_H_ */
110