Home | History | Annotate | Line # | Download | only in sys
disklabel_rdb.h revision 1.1
      1  1.1  phx /*	$NetBSD: disklabel_rdb.h,v 1.1 2009/09/12 08:23:25 phx Exp $	*/
      2  1.1  phx 
      3  1.1  phx /*
      4  1.1  phx  * Copyright (c) 1994 Christian E. Hopps
      5  1.1  phx  * All rights reserved.
      6  1.1  phx  *
      7  1.1  phx  * Redistribution and use in source and binary forms, with or without
      8  1.1  phx  * modification, are permitted provided that the following conditions
      9  1.1  phx  * are met:
     10  1.1  phx  * 1. Redistributions of source code must retain the above copyright
     11  1.1  phx  *    notice, this list of conditions and the following disclaimer.
     12  1.1  phx  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  phx  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  phx  *    documentation and/or other materials provided with the distribution.
     15  1.1  phx  * 3. All advertising materials mentioning features or use of this software
     16  1.1  phx  *    must display the following acknowledgement:
     17  1.1  phx  *      This product includes software developed by Christian E. Hopps.
     18  1.1  phx  * 4. The name of the author may not be used to endorse or promote products
     19  1.1  phx  *    derived from this software without specific prior written permission
     20  1.1  phx  *
     21  1.1  phx  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1  phx  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1  phx  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1  phx  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1  phx  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1  phx  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  phx  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1  phx  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1  phx  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1  phx  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1  phx  */
     32  1.1  phx #ifndef _SYS_DISKLABEL_RDB_H_
     33  1.1  phx #define _SYS_DISKLABEL_RDB_H_
     34  1.1  phx 
     35  1.1  phx /*
     36  1.1  phx  * describes ados Rigid Disk Blocks
     37  1.1  phx  * which are used to partition a drive
     38  1.1  phx  */
     39  1.1  phx #define RDBNULL ((u_long)0xffffffff)
     40  1.1  phx 
     41  1.1  phx /*
     42  1.1  phx  * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
     43  1.1  phx  */
     44  1.1  phx #define RDB_MAXBLOCKS	16
     45  1.1  phx 
     46  1.1  phx struct rdblock {
     47  1.1  phx 	u_long id;		/* 'RDSK' */
     48  1.1  phx 	u_long nsumlong;	/* number of longs in check sum */
     49  1.1  phx 	u_long chksum;		/* simple additive with wrap checksum */
     50  1.1  phx 	u_long hostid;		/* scsi target of host */
     51  1.1  phx 	u_long nbytes;		/* size of disk blocks */
     52  1.1  phx 	u_long flags;
     53  1.1  phx 	u_long badbhead;	/* linked list of badblocks */
     54  1.1  phx 	u_long partbhead;	/* linked list of partblocks */
     55  1.1  phx 	u_long fsbhead;		/*   "     "   of fsblocks */
     56  1.1  phx 	u_long driveinit;
     57  1.1  phx 	u_long resv1[6];	/* RDBNULL */
     58  1.1  phx 	u_long ncylinders;	/* number of cylinders on drive */
     59  1.1  phx 	u_long nsectors;	/* number of sectors per track */
     60  1.1  phx 	u_long nheads;		/* number of tracks per cylinder */
     61  1.1  phx 	u_long interleave;
     62  1.1  phx 	u_long park;		/* only used with st506 i.e. not */
     63  1.1  phx 	u_long resv2[3];
     64  1.1  phx 	u_long wprecomp;	/* start cyl for write precomp */
     65  1.1  phx 	u_long reducedwrite;	/* start cyl for reduced write current */
     66  1.1  phx 	u_long steprate;	/* driver step rate in ?s */
     67  1.1  phx 	u_long resv3[5];
     68  1.1  phx 	u_long rdblowb;		/* lowblock of range for rdb's */
     69  1.1  phx 	u_long rdbhighb;	/* high block of range for rdb's */
     70  1.1  phx 	u_long lowcyl;		/* low cylinder of partition area */
     71  1.1  phx 	u_long highcyl;		/* upper cylinder of partition area */
     72  1.1  phx 	u_long secpercyl;	/* number of sectors per cylinder */
     73  1.1  phx 	u_long parkseconds;	/* zero if no park needed */
     74  1.1  phx 	u_long resv4[2];
     75  1.1  phx 	char   diskvendor[8];	/* inquiry stuff */
     76  1.1  phx 	char   diskproduct[16];	/* inquiry stuff */
     77  1.1  phx 	char   diskrevision[4];	/* inquiry stuff */
     78  1.1  phx 	char   contvendor[8];	/* inquiry stuff */
     79  1.1  phx 	char   contproduct[16];	/* inquiry stuff */
     80  1.1  phx 	char   contrevision[4];	/* inquiry stuff */
     81  1.1  phx #if never_use_secsize
     82  1.1  phx 	u_long resv5[0];
     83  1.1  phx #endif
     84  1.1  phx };
     85  1.1  phx 
     86  1.1  phx 
     87  1.1  phx #define RDBF_LAST	0x1	/* last drive available */
     88  1.1  phx #define RDBF_LASTLUN	0x2	/* last LUN available */
     89  1.1  phx #define RDBF_LASTUNIT	0x4	/* last target available */
     90  1.1  phx #define RDBF_NORESELECT	0x8	/* do not use reselect */
     91  1.1  phx #define RDBF_DISKID	0x10	/* disk id is valid ?? */
     92  1.1  phx #define RDBF_CTRLID	0x20	/* ctrl id is valid ?? */
     93  1.1  phx #define RDBF_SYNC	0x40	/* drive supports SCSI synchronous mode */
     94  1.1  phx 
     95  1.1  phx struct ados_environ {
     96  1.1  phx 	u_long tabsize;		/* 0: environ table size */
     97  1.1  phx 	u_long sizeblock;	/* 1: n long words in a block */
     98  1.1  phx 	u_long secorg;		/* 2: not used must be zero */
     99  1.1  phx 	u_long numheads;	/* 3: number of surfaces */
    100  1.1  phx 	u_long secperblk;	/* 4: must be 1 */
    101  1.1  phx 	u_long secpertrk;	/* 5: blocks per track */
    102  1.1  phx 	u_long resvblocks;	/* 6: reserved blocks at start */
    103  1.1  phx 	u_long prefac;		/* 7: must be 0 */
    104  1.1  phx 	u_long interleave;	/* 8: normally 1 */
    105  1.1  phx 	u_long lowcyl;		/* 9: low cylinder of partition */
    106  1.1  phx 	u_long highcyl;		/* 10: upper cylinder of partition */
    107  1.1  phx 	u_long numbufs;		/* 11: ados: number of buffers */
    108  1.1  phx 	u_long membuftype;	/* 12: ados: type of bufmem */
    109  1.1  phx 	u_long maxtrans;	/* 13: maxtrans the ctrlr supports */
    110  1.1  phx 	u_long mask;		/* 14: mask for valid address */
    111  1.1  phx 	u_long bootpri;		/* 15: boot priority for autoboot */
    112  1.1  phx 	u_long dostype;		/* 16: filesystem type */
    113  1.1  phx 	u_long baud;		/* 17: serial handler baud rate */
    114  1.1  phx 	u_long control;		/* 18: control word for fs */
    115  1.1  phx 	u_long bootblocks;	/* 19: blocks containing boot code */
    116  1.1  phx 	u_long fsize;		/* 20: file system block size */
    117  1.1  phx 	u_long frag;		/* 21: allowable frags per block */
    118  1.1  phx 	u_long cpg;		/* 22: cylinders per group */
    119  1.1  phx };
    120  1.1  phx 
    121  1.1  phx struct partblock {
    122  1.1  phx 	u_long id;		/* 'PART' */
    123  1.1  phx 	u_long nsumlong;	/* number of longs in check sum */
    124  1.1  phx 	u_long chksum;		/* simple additive with wrap checksum */
    125  1.1  phx 	u_long hostid;		/* scsi target of host */
    126  1.1  phx 	u_long next;		/* next in chain */
    127  1.1  phx 	u_long flags;		/* see below */
    128  1.1  phx 	u_long resv1[3];
    129  1.1  phx 	u_char partname[32];	/* (BCPL) part name (may not be unique) */
    130  1.1  phx 	u_long resv2[15];
    131  1.1  phx 	struct ados_environ e;
    132  1.1  phx #if never_use_secsize
    133  1.1  phx 	u_long extra[9];	/* 8 for extra added to environ */
    134  1.1  phx #endif
    135  1.1  phx };
    136  1.1  phx 
    137  1.1  phx #define PBF_BOOTABLE	0x1	/* partition is bootable */
    138  1.1  phx #define PBF_NOMOUNT	0x2	/* partition should be mounted */
    139  1.1  phx 
    140  1.1  phx struct badblock {
    141  1.1  phx 	u_long id;		/* 'BADB' */
    142  1.1  phx 	u_long nsumlong;	/* number of longs in check sum */
    143  1.1  phx 	u_long chksum;		/* simple additive with wrap checksum */
    144  1.1  phx 	u_long hostid;		/* scsi target of host */
    145  1.1  phx 	u_long next;		/* next in chain */
    146  1.1  phx 	u_long resv;
    147  1.1  phx 	struct badblockent {
    148  1.1  phx 		u_long badblock;
    149  1.1  phx 		u_long goodblock;
    150  1.1  phx 	} badtab[0];		/* 61 for secsize == 512 */
    151  1.1  phx };
    152  1.1  phx 
    153  1.1  phx struct fsblock {
    154  1.1  phx 	u_long id;		/* 'FSHD' */
    155  1.1  phx 	u_long nsumlong;	/* number of longs in check sum */
    156  1.1  phx 	u_long chksum;		/* simple additive with wrap checksum */
    157  1.1  phx 	u_long hostid;		/* scsi target of host */
    158  1.1  phx 	u_long next;		/* next in chain */
    159  1.1  phx 	u_long flags;
    160  1.1  phx 	u_long resv1[2];
    161  1.1  phx 	u_long dostype;		/* this is a file system for this type */
    162  1.1  phx 	u_long version;		/* version of this fs */
    163  1.1  phx 	u_long patchflags;	/* describes which functions to replace */
    164  1.1  phx 	u_long type;		/* zero */
    165  1.1  phx 	u_long task;		/* zero */
    166  1.1  phx 	u_long lock;		/* zero */
    167  1.1  phx 	u_long handler;		/* zero */
    168  1.1  phx 	u_long stacksize;	/* to use when loading handler */
    169  1.1  phx 	u_long priority;	/* to run the fs at. */
    170  1.1  phx 	u_long startup;		/* zero */
    171  1.1  phx 	u_long lsegblocks;	/* linked list of lsegblocks of fs code */
    172  1.1  phx 	u_long globalvec;	/* bcpl vector not used mostly */
    173  1.1  phx #if never_use_secsize
    174  1.1  phx 	u_long resv2[44];
    175  1.1  phx #endif
    176  1.1  phx };
    177  1.1  phx 
    178  1.1  phx struct lsegblock {
    179  1.1  phx 	u_long id;		/* 'LSEG' */
    180  1.1  phx 	u_long nsumlong;	/* number of longs in check sum */
    181  1.1  phx 	u_long chksum;		/* simple additive with wrap checksum */
    182  1.1  phx 	u_long hostid;		/* scsi target of host */
    183  1.1  phx 	u_long next;		/* next in chain */
    184  1.1  phx 	u_long loaddata[0];	/* load segment data, 123 for secsize == 512 */
    185  1.1  phx };
    186  1.1  phx 
    187  1.1  phx #define RDBLOCK_ID	0x5244534b	/* 'RDSK' */
    188  1.1  phx #define PARTBLOCK_ID	0x50415254	/* 'PART' */
    189  1.1  phx #define BADBLOCK_ID	0x42414442	/* 'BADB' */
    190  1.1  phx #define FSBLOCK_ID	0x46534844	/* 'FSHD' */
    191  1.1  phx #define LSEGBLOCK_ID	0x4c534547	/* 'LSEG' */
    192  1.1  phx 
    193  1.1  phx /*
    194  1.1  phx  * Dos types for identifying file systems
    195  1.1  phx  * bsd file systems will be 'N','B',x,y where y is the fstype found in
    196  1.1  phx  * disklabel.h (for DOST_DOS it will be the version number)
    197  1.1  phx  */
    198  1.1  phx #define DOST_XXXBSD	0x42534400	/* Old type back compat*/
    199  1.1  phx #define DOST_NBR	0x4e425200	/* 'NBRx' NetBSD root partition */
    200  1.1  phx #define DOST_NBS	0x4e425300	/* 'NBS0' NetBSD swap partition */
    201  1.1  phx #define DOST_NBU	0x4e425500	/* 'NBUx' NetBSD user partition */
    202  1.1  phx #define DOST_DOS	0x444f5300	/* 'DOSx' AmigaDos partition */
    203  1.1  phx #define DOST_AMIX	0x554e4900	/* 'UNIx' AmigaDos partition */
    204  1.1  phx #define DOST_MUFS	0x6d754600	/* 'muFx' AmigaDos partition (muFS) */
    205  1.1  phx #define DOST_EXT2	0x4c4e5800	/* 'LNX0' Linux fs partition (ext2fs) */
    206  1.1  phx #define DOST_LNXSWP	0x53575000	/* 'SWP0' Linux swap partition */
    207  1.1  phx #define DOST_RAID	0x52414900	/* 'RAID' Raidframe partition */
    208  1.1  phx 
    209  1.1  phx struct adostype {
    210  1.1  phx 	u_char archtype;	/* see ADT_xxx below */
    211  1.1  phx 	u_char fstype;		/* byte 3 from amiga dostype */
    212  1.1  phx };
    213  1.1  phx 
    214  1.1  phx /* archtypes */
    215  1.1  phx #define ADT_UNKNOWN	0
    216  1.1  phx #define ADT_AMIGADOS	1
    217  1.1  phx #define ADT_NETBSDROOT	2
    218  1.1  phx #define ADT_NETBSDSWAP	3
    219  1.1  phx #define ADT_NETBSDUSER	4
    220  1.1  phx #define ADT_AMIX	5
    221  1.1  phx #define ADT_EXT2	6
    222  1.1  phx #define ADT_RAID	7
    223  1.1  phx 
    224  1.1  phx #define ISFSARCH_NETBSD(adt) \
    225  1.1  phx 	((adt).archtype >= ADT_NETBSDROOT && (adt).archtype <= ADT_NETBSDUSER)
    226  1.1  phx 
    227  1.1  phx #endif /* _SYS_DISKLABEL_RDB_H_ */
    228