disklabel.h revision 1.1
11.1Schopps/* 21.1Schopps * Copyright (c) 1994 Christian E. Hopps 31.1Schopps * All rights reserved. 41.1Schopps * 51.1Schopps * Redistribution and use in source and binary forms, with or without 61.1Schopps * modification, are permitted provided that the following conditions 71.1Schopps * are met: 81.1Schopps * 1. Redistributions of source code must retain the above copyright 91.1Schopps * notice, this list of conditions and the following disclaimer. 101.1Schopps * 2. Redistributions in binary form must reproduce the above copyright 111.1Schopps * notice, this list of conditions and the following disclaimer in the 121.1Schopps * documentation and/or other materials provided with the distribution. 131.1Schopps * 3. All advertising materials mentioning features or use of this software 141.1Schopps * must display the following acknowledgement: 151.1Schopps * This product includes software developed by Christian E. Hopps. 161.1Schopps * 4. The name of the author may not be used to endorse or promote products 171.1Schopps * derived from this software without specific prior written permission 181.1Schopps * 191.1Schopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 201.1Schopps * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 211.1Schopps * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 221.1Schopps * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 231.1Schopps * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 241.1Schopps * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251.1Schopps * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261.1Schopps * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271.1Schopps * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 281.1Schopps * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291.1Schopps * 301.1Schopps * $Id: disklabel.h,v 1.1 1994/05/08 05:53:57 chopps Exp $ 311.1Schopps */ 321.1Schopps#ifndef _MACHINE_DISKLABEL_H_ 331.1Schopps#define _MACHINE_DISKLABEL_H_ 341.1Schopps 351.1Schopps#ifndef MAXPARTITIONS 361.1Schopps#define MAXPARTITIONS 16 371.1Schopps#endif 381.1Schopps 391.1Schopps#define RAW_PART 2 /* Xd0c is raw part. */ 401.1Schopps 411.1Schopps/* 421.1Schopps * used to encode disk minor numbers 431.1Schopps */ 441.1Schopps#define DISKUNITSHIFT 3 /* log2(MAXPARTITIONS) */ 451.1Schopps#define DISKUNIT(dev) (minor(dev) >> DISKUNITSHIFT ) 461.1Schopps#define DISKPARTMASK ((1 << DISKUNITSHIFT) - 1) 471.1Schopps#define DISKPART(dev) (minor(dev) & DISKPARTMASK) 481.1Schopps#define MAKEDISKDEV(maj, unit, part) \ 491.1Schopps (makedev((maj),((unit) << DISKUNITSHIFT) | ((part) & DISKPARTMASK))) 501.1Schopps 511.1Schopps/* 521.1Schopps * describes ados Rigid Disk Blocks 531.1Schopps * which are used to partition a drive 541.1Schopps */ 551.1Schopps#define RDBNULL ((u_long)0xffffffff) 561.1Schopps 571.1Schopps/* 581.1Schopps * you will find rdblock somewhere in [0, RDBMAXBLOCKS) 591.1Schopps */ 601.1Schopps#define RDB_MAXBLOCKS 16 611.1Schopps 621.1Schoppsstruct rdblock { 631.1Schopps u_long id; /* 'RDSK' */ 641.1Schopps u_long nsumlong; /* number of longs in check sum */ 651.1Schopps u_long chksum; /* simple additive with wrap checksum */ 661.1Schopps u_long hostid; /* scsi target of host */ 671.1Schopps u_long nbytes; /* size of disk blocks */ 681.1Schopps u_long flags; 691.1Schopps u_long badbhead; /* linked list of badblocks */ 701.1Schopps u_long partbhead; /* linked list of partblocks */ 711.1Schopps u_long fsbhead; /* " " of fsblocks */ 721.1Schopps u_long driveinit; 731.1Schopps u_long resv1[6]; /* RDBNULL */ 741.1Schopps u_long ncylinders; /* number of cylinders on drive */ 751.1Schopps u_long nsectors; /* number of sectors per track */ 761.1Schopps u_long nheads; /* number of tracks per cylinder */ 771.1Schopps u_long interleave; 781.1Schopps u_long park; /* only used with st506 i.e. not */ 791.1Schopps u_long resv2[3]; 801.1Schopps u_long wprecomp; /* start cyl for write precomp */ 811.1Schopps u_long reducedwrite; /* start cyl for reduced write current */ 821.1Schopps u_long steprate; /* driver step rate in ?s */ 831.1Schopps u_long resv3[5]; 841.1Schopps u_long rdblowb; /* lowblock of range for rdb's */ 851.1Schopps u_long rdbhighb; /* high block of range for rdb's */ 861.1Schopps u_long lowcyl; /* low cylinder of partition area */ 871.1Schopps u_long highcyl; /* upper cylinder of partition area */ 881.1Schopps u_long secpercyl; /* number of sectors per cylinder */ 891.1Schopps u_long parkseconds; /* zero if no park needed */ 901.1Schopps u_long resv4[2]; 911.1Schopps char diskvendor[8]; /* inquiry stuff */ 921.1Schopps char diskproduct[16]; /* inquiry stuff */ 931.1Schopps char diskrevision[4]; /* inquiry stuff */ 941.1Schopps char contvendor[8]; /* inquiry stuff */ 951.1Schopps char contproduct[16]; /* inquiry stuff */ 961.1Schopps char contrevision[4]; /* inquiry stuff */ 971.1Schopps#if never_use_secsize 981.1Schopps u_long resv5[0]; 991.1Schopps#endif 1001.1Schopps}; 1011.1Schopps 1021.1Schopps 1031.1Schopps#define RDBF_LAST 0x1 /* last drive available */ 1041.1Schopps#define RDBF_LASTLUN 0x2 /* last LUN available */ 1051.1Schopps#define RDBF_LASTUNIT 0x4 /* last target available */ 1061.1Schopps#define RDBF_NORESELECT 0x8 /* do not use reselect */ 1071.1Schopps#define RDBF_DISKID 0x10 /* disk id is valid ?? */ 1081.1Schopps#define RDBF_CTRLID 0x20 /* ctrl id is valid ?? */ 1091.1Schopps 1101.1Schoppsstruct ados_environ { 1111.1Schopps u_long tabsize; /* 0: environ table size */ 1121.1Schopps u_long sizeblock; /* 1: n long words in a block */ 1131.1Schopps u_long secorg; /* 2: not used must be zero */ 1141.1Schopps u_long numheads; /* 3: number of surfaces */ 1151.1Schopps u_long secperblk; /* 4: must be 1 */ 1161.1Schopps u_long secpertrk; /* 5: blocks per track */ 1171.1Schopps u_long resvblocks; /* 6: reserved blocks at start */ 1181.1Schopps u_long prefac; /* 7: must be 0 */ 1191.1Schopps u_long interleave; /* 8: normally 1 */ 1201.1Schopps u_long lowcyl; /* 9: low cylinder of partition */ 1211.1Schopps u_long highcyl; /* 10: upper cylinder of partition */ 1221.1Schopps u_long numbufs; /* 11: ados: number of buffers */ 1231.1Schopps u_long membuftype; /* 12: ados: type of bufmem */ 1241.1Schopps u_long maxtrans; /* 13: maxtrans the ctrlr supports */ 1251.1Schopps u_long mask; /* 14: mask for valid address */ 1261.1Schopps u_long bootpri; /* 15: boot priority for autoboot */ 1271.1Schopps u_long dostype; /* 16: filesystem type */ 1281.1Schopps u_long baud; /* 17: serial handler baud rate */ 1291.1Schopps u_long control; /* 18: control word for fs */ 1301.1Schopps u_long bootblocks; /* 19: blocks containing boot code */ 1311.1Schopps u_long fsize; /* 20: file system block size */ 1321.1Schopps u_long frag; /* 21: allowable frags per block */ 1331.1Schopps u_long cpg; /* 22: cylinders per group */ 1341.1Schopps}; 1351.1Schopps 1361.1Schoppsstruct partblock { 1371.1Schopps u_long id; /* 'PART' */ 1381.1Schopps u_long nsumlong; /* number of longs in check sum */ 1391.1Schopps u_long chksum; /* simple additive with wrap checksum */ 1401.1Schopps u_long hostid; /* scsi target of host */ 1411.1Schopps u_long next; /* next in chain */ 1421.1Schopps u_long flags; /* see below */ 1431.1Schopps u_long resv1[3]; 1441.1Schopps u_char partname[32]; /* (BCPL) part name (may not be unique) */ 1451.1Schopps u_long resv2[15]; 1461.1Schopps struct ados_environ e; 1471.1Schopps#if never_use_secsize 1481.1Schopps u_long extra[9]; /* 8 for extra added to environ */ 1491.1Schopps#endif 1501.1Schopps}; 1511.1Schopps 1521.1Schopps#define PBF_BOOTABLE 0x1 /* partition is bootable */ 1531.1Schopps#define PBF_NOMOUNT 0x2 /* partition should be mounted */ 1541.1Schopps 1551.1Schoppsstruct badblock { 1561.1Schopps u_long id; /* 'BADB' */ 1571.1Schopps u_long nsumlong; /* number of longs in check sum */ 1581.1Schopps u_long chksum; /* simple additive with wrap checksum */ 1591.1Schopps u_long hostid; /* scsi target of host */ 1601.1Schopps u_long next; /* next in chain */ 1611.1Schopps u_long resv; 1621.1Schopps struct badblockent { 1631.1Schopps u_long badblock; 1641.1Schopps u_long goodblock; 1651.1Schopps } badtab[0]; /* 61 for secsize == 512 */ 1661.1Schopps}; 1671.1Schopps 1681.1Schoppsstruct fsblock { 1691.1Schopps u_long id; /* 'FSHD' */ 1701.1Schopps u_long nsumlong; /* number of longs in check sum */ 1711.1Schopps u_long chksum; /* simple additive with wrap checksum */ 1721.1Schopps u_long hostid; /* scsi target of host */ 1731.1Schopps u_long next; /* next in chain */ 1741.1Schopps u_long flags; 1751.1Schopps u_long resv1[2]; 1761.1Schopps u_long dostype; /* this is a file system for this type */ 1771.1Schopps u_long version; /* version of this fs */ 1781.1Schopps u_long patchflags; /* describes which functions to replace */ 1791.1Schopps u_long type; /* zero */ 1801.1Schopps u_long task; /* zero */ 1811.1Schopps u_long lock; /* zero */ 1821.1Schopps u_long handler; /* zero */ 1831.1Schopps u_long stacksize; /* to use when loading handler */ 1841.1Schopps u_long priority; /* to run the fs at. */ 1851.1Schopps u_long startup; /* zero */ 1861.1Schopps u_long lsegblocks; /* linked list of lsegblocks of fs code */ 1871.1Schopps u_long globalvec; /* bcpl vector not used mostly */ 1881.1Schopps#if never_use_secsize 1891.1Schopps u_long resv2[44]; 1901.1Schopps#endif 1911.1Schopps}; 1921.1Schopps 1931.1Schoppsstruct lsegblock { 1941.1Schopps u_long id; /* 'LSEG' */ 1951.1Schopps u_long nsumlong; /* number of longs in check sum */ 1961.1Schopps u_long chksum; /* simple additive with wrap checksum */ 1971.1Schopps u_long hostid; /* scsi target of host */ 1981.1Schopps u_long next; /* next in chain */ 1991.1Schopps u_long loaddata[0]; /* load segment data, 123 for secsize == 512 */ 2001.1Schopps}; 2011.1Schopps 2021.1Schopps#define RDBLOCK_ID 0x5244534b /* 'RDSK' */ 2031.1Schopps#define PARTBLOCK_ID 0x50415254 /* 'PART' */ 2041.1Schopps#define BADBLOCK_ID 0x42414442 /* 'BADB' */ 2051.1Schopps#define FSBLOCK_ID 0x46534844 /* 'FSHD' */ 2061.1Schopps#define LSEGBLOCK_ID 0x4c534547 /* 'LSEG' */ 2071.1Schopps 2081.1Schoppsstruct cpu_disklabel { 2091.1Schopps u_long rdblock; /* may be RDBNULL which invalidates */ 2101.1Schopps u_long pblist[MAXPARTITIONS]; /* partblock number (RDB list order) */ 2111.1Schopps char pbindex[MAXPARTITIONS]; /* index of pblock (partition order) */ 2121.1Schopps int valid; /* essential that this is valid */ 2131.1Schopps}; 2141.1Schopps 2151.1Schopps#endif /* _MACHINE_DISKLABEL_H_ */ 216