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