Home | History | Annotate | Line # | Download | only in include
disklabel.h revision 1.2
      1  1.2  christos /*	$NetBSD: disklabel.h,v 1.2 2002/07/11 16:03:14 christos 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.2  christos #define	CPUMAXPARTITIONS	8	/* number of partitions in cpu_disklabel */
     42  1.1       dbj #define CD_V1	0x4e655854	/* version #1: "NeXT" */
     43  1.1       dbj #define CD_V2	0x646c5632	/* version #2: "dlV2" */
     44  1.1       dbj #define CD_V3	0x646c5633	/* version #3: "dlV3" */
     45  1.1       dbj #define IS_DISKLABEL(l) ((l)->cd_version == CD_V1 || (l)->cd_version == CD_V2 \
     46  1.1       dbj                          || (l)->cd_version == CD_V3)
     47  1.1       dbj 
     48  1.1       dbj /* XXX should we really size all this stuff this way ? */
     49  1.1       dbj #define CPULBLLEN	24
     50  1.1       dbj #define MAXDNMLEN	24
     51  1.1       dbj #define MAXTYPLEN       24
     52  1.1       dbj #define MAXBFLEN	24
     53  1.1       dbj #define MAXHNLEN	32
     54  1.1       dbj #define MAXMPTLEN       16
     55  1.1       dbj #define MAXFSTLEN       8
     56  1.1       dbj 
     57  1.2  christos #define DEFAULTFRONTPORCH (160 * 2)
     58  1.2  christos #define DEFAULTBOOT0_1 (32 * 2)
     59  1.2  christos #define DEFAULTBOOT0_2 (96 * 2)
     60  1.2  christos 
     61  1.2  christos struct  cpu_partition {
     62  1.2  christos 	int cp_offset;		/* starting sector */
     63  1.2  christos 	int cp_size;		/* number of sectors in partition */
     64  1.2  christos 	short cp_bsize;		/* block size in bytes */
     65  1.2  christos 	short cp_fsize;		/* filesystem basic fragment size */
     66  1.2  christos 	char cp_opt;		/* optimization type: 's'pace/'t'ime */
     67  1.2  christos 	char cp_pad1;
     68  1.2  christos 	short cp_cpg;		/* filesystem cylinders per group */
     69  1.2  christos 	short cp_density;	/* bytes per inode density */
     70  1.2  christos 	char cp_minfree;	/* minfree (%) */
     71  1.2  christos 	char cp_newfs;		/* run newfs during init */
     72  1.2  christos 	char cp_mountpt[MAXMPTLEN];/* default/standard mount point */
     73  1.2  christos 	char cp_automnt;	/* auto-mount when inserted */
     74  1.2  christos 	char cp_type[MAXFSTLEN]; /* file system type name */
     75  1.2  christos 	char cp_pad2;
     76  1.2  christos } __attribute__ ((packed));
     77  1.2  christos 
     78  1.1       dbj /* The disklabel the way it is on the disk */
     79  1.2  christos struct nextstep_disklabel {
     80  1.1       dbj     int cd_version;		/* label version */
     81  1.1       dbj     int cd_label_blkno;         /* block # of this label */
     82  1.1       dbj     int cd_size;                /* size of media area (sectors) */
     83  1.1       dbj     char cd_label[CPULBLLEN];	/* disk name (label) */
     84  1.1       dbj     u_int cd_flags;		/* flags */
     85  1.1       dbj #define CD_UNINIT	0x80000000 /* label is uninitialized */
     86  1.1       dbj     u_int cd_tag;		/* volume tag */
     87  1.1       dbj     char cd_name[MAXDNMLEN];	/* drive (hardware) name */
     88  1.1       dbj     char cd_type[MAXTYPLEN];	/* drive type */
     89  1.1       dbj     int cd_secsize;		/* # of bytes per sector */
     90  1.1       dbj     int cd_ntracks;		/* # of tracks per cylinder */
     91  1.1       dbj     int cd_nsectors;		/* # of data sectors per track */
     92  1.1       dbj     int cd_ncylinders;          /* # of data cylinders per unit */
     93  1.1       dbj     int cd_rpm;                 /* rotational speed */
     94  1.1       dbj     short cd_front;		/* # of sectors in "front porch" */
     95  1.1       dbj     short cd_back;		/* # of sectors in "back porch" */
     96  1.1       dbj     short cd_ngroups;		/* # of alt groups */
     97  1.1       dbj     short cd_ag_size;		/* alt group size (sectors) */
     98  1.1       dbj     short cd_ag_alts;		/* alternate sectors / alt group */
     99  1.1       dbj     short cd_ag_off;		/* sector offset to first alternate */
    100  1.1       dbj     int cd_boot_blkno[2];	/* boot program locations */
    101  1.1       dbj     char cd_kernel[MAXBFLEN];	/* default kernel name */
    102  1.1       dbj     char cd_hostname[MAXHNLEN];	/* host name (usu. where disk was labeled) */
    103  1.1       dbj     char cd_rootpartition;	/* root partition letter e.g. 'a' */
    104  1.1       dbj     char cd_rwpartition;	/* r/w partition letter e.g. 'b' */
    105  1.2  christos     struct cpu_partition cd_partitions[CPUMAXPARTITIONS];
    106  1.1       dbj 
    107  1.1       dbj     union {
    108  1.1       dbj 	u_short CD_v3_checksum;	/* label version 3 checksum */
    109  1.1       dbj #define NBAD	1670		/* sized to make label ~= 8KB */
    110  1.1       dbj 	int CD_bad[NBAD];   /* block number that is bad */
    111  1.1       dbj     } cd_un;
    112  1.1       dbj #define cd_v3_checksum  cd_un.CD_v3_checksum
    113  1.1       dbj #define cd_bad          cd_un.CD_bad
    114  1.1       dbj     u_short cd_checksum;	/* label version 1 or 2 checksum */
    115  1.2  christos } __attribute__ ((packed));
    116  1.2  christos 
    117  1.2  christos struct cpu_disklabel {
    118  1.2  christos 	int od_version;
    119  1.1       dbj };
    120  1.1       dbj 
    121  1.1       dbj #endif /* _MACHINE_DISKLABEL_H_ */
    122