Home | History | Annotate | Line # | Download | only in include
disklabel.h revision 1.7.8.3
      1  1.7.8.1   nathanw /*	$NetBSD: disklabel.h,v 1.7.8.3 2002/09/17 21:15:39 nathanw Exp $	*/
      2      1.1    tsubai 
      3      1.1    tsubai /*-
      4      1.1    tsubai  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
      5      1.1    tsubai  * Copyright (C) 1995, 1996 TooLs GmbH.
      6      1.1    tsubai  * All rights reserved.
      7      1.1    tsubai  *
      8      1.1    tsubai  * Redistribution and use in source and binary forms, with or without
      9      1.1    tsubai  * modification, are permitted provided that the following conditions
     10      1.1    tsubai  * are met:
     11      1.1    tsubai  * 1. Redistributions of source code must retain the above copyright
     12      1.1    tsubai  *    notice, this list of conditions and the following disclaimer.
     13      1.1    tsubai  * 2. Redistributions in binary form must reproduce the above copyright
     14      1.1    tsubai  *    notice, this list of conditions and the following disclaimer in the
     15      1.1    tsubai  *    documentation and/or other materials provided with the distribution.
     16      1.1    tsubai  * 3. All advertising materials mentioning features or use of this software
     17      1.1    tsubai  *    must display the following acknowledgement:
     18      1.1    tsubai  *	This product includes software developed by TooLs GmbH.
     19      1.1    tsubai  * 4. The name of TooLs GmbH may not be used to endorse or promote products
     20      1.1    tsubai  *    derived from this software without specific prior written permission.
     21      1.1    tsubai  *
     22      1.1    tsubai  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
     23      1.1    tsubai  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24      1.1    tsubai  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25      1.1    tsubai  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26      1.1    tsubai  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27      1.1    tsubai  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     28      1.1    tsubai  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     29      1.1    tsubai  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     30      1.1    tsubai  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     31      1.1    tsubai  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32      1.1    tsubai  */
     33      1.4  wrstuden /*
     34      1.4  wrstuden  * Copyright (c) 1994 Christopher G. Demetriou
     35      1.4  wrstuden  * All rights reserved.
     36      1.4  wrstuden  *
     37      1.4  wrstuden  * Redistribution and use in source and binary forms, with or without
     38      1.4  wrstuden  * modification, are permitted provided that the following conditions
     39      1.4  wrstuden  * are met:
     40      1.4  wrstuden  * 1. Redistributions of source code must retain the above copyright
     41      1.4  wrstuden  *    notice, this list of conditions and the following disclaimer.
     42      1.4  wrstuden  * 2. Redistributions in binary form must reproduce the above copyright
     43      1.4  wrstuden  *    notice, this list of conditions and the following disclaimer in the
     44      1.4  wrstuden  *    documentation and/or other materials provided with the distribution.
     45      1.4  wrstuden  * 3. All advertising materials mentioning features or use of this software
     46      1.4  wrstuden  *    must display the following acknowledgement:
     47      1.4  wrstuden  *      This product includes software developed by Christopher G. Demetriou.
     48      1.4  wrstuden  * 4. The name of the author may not be used to endorse or promote products
     49      1.4  wrstuden  *    derived from this software without specific prior written permission
     50      1.4  wrstuden  *
     51      1.4  wrstuden  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     52      1.4  wrstuden  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     53      1.4  wrstuden  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     54      1.4  wrstuden  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     55      1.4  wrstuden  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     56      1.4  wrstuden  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     57      1.4  wrstuden  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     58      1.4  wrstuden  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     59      1.4  wrstuden  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     60      1.4  wrstuden  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     61      1.4  wrstuden  */
     62      1.4  wrstuden /*-
     63      1.4  wrstuden  * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
     64      1.4  wrstuden  *			Michael L. Finch, Bradley A. Grantham, and
     65      1.4  wrstuden  *			Lawrence A. Kesteloot
     66      1.4  wrstuden  * All rights reserved.
     67      1.4  wrstuden  *
     68      1.4  wrstuden  * Redistribution and use in source and binary forms, with or without
     69      1.4  wrstuden  * modification, are permitted provided that the following conditions
     70      1.4  wrstuden  * are met:
     71      1.4  wrstuden  * 1. Redistributions of source code must retain the above copyright
     72      1.4  wrstuden  *    notice, this list of conditions and the following disclaimer.
     73      1.4  wrstuden  * 2. Redistributions in binary form must reproduce the above copyright
     74      1.4  wrstuden  *    notice, this list of conditions and the following disclaimer in the
     75      1.4  wrstuden  *    documentation and/or other materials provided with the distribution.
     76      1.4  wrstuden  * 3. All advertising materials mentioning features or use of this software
     77      1.4  wrstuden  *    must display the following acknowledgement:
     78      1.4  wrstuden  *	This product includes software developed by the Alice Group.
     79      1.4  wrstuden  * 4. The names of the Alice Group or any of its members may not be used
     80      1.4  wrstuden  *    to endorse or promote products derived from this software without
     81      1.4  wrstuden  *    specific prior written permission.
     82      1.4  wrstuden  *
     83      1.4  wrstuden  * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
     84      1.4  wrstuden  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     85      1.4  wrstuden  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     86      1.4  wrstuden  * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
     87      1.4  wrstuden  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     88      1.4  wrstuden  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     89      1.4  wrstuden  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     90      1.4  wrstuden  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     91      1.4  wrstuden  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     92      1.4  wrstuden  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     93      1.4  wrstuden  *
     94      1.4  wrstuden  */
     95      1.1    tsubai 
     96      1.1    tsubai #ifndef	_MACHINE_DISKLABEL_H_
     97      1.1    tsubai #define	_MACHINE_DISKLABEL_H_
     98      1.1    tsubai 
     99      1.1    tsubai #define	LABELSECTOR	0		/* sector containing label */
    100      1.1    tsubai #define	LABELOFFSET	64		/* offset of label in sector */
    101  1.7.8.2   nathanw #define	MBR_LABELSECTOR	1		/* sector containing label - in MBR */
    102  1.7.8.2   nathanw #define	MBR_LABELOFFSET	0		/* offset of label in sector - in MBR */
    103      1.1    tsubai #define	MAXPARTITIONS	16		/* number of partitions */
    104      1.1    tsubai #define	RAW_PART	2		/* raw partition: XX?c */
    105      1.1    tsubai 
    106      1.1    tsubai struct cpu_disklabel {
    107  1.7.8.2   nathanw 	daddr_t cd_start;	/* Offset to NetBSD partition in blocks */
    108  1.7.8.2   nathanw 	daddr_t cd_labelsector;	/* label sector offset from cd_start */
    109  1.7.8.2   nathanw 	int cd_labeloffset;	/* label byte offset within label sector */
    110      1.1    tsubai };
    111      1.4  wrstuden 
    112      1.4  wrstuden /*
    113      1.4  wrstuden  * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
    114      1.4  wrstuden  * pp 12-13.  The driver descriptor map always resides on physical block 0.
    115      1.4  wrstuden  */
    116      1.4  wrstuden struct drvr_descriptor {
    117      1.4  wrstuden 	u_int32_t	descBlock;	/* first block of driver */
    118      1.4  wrstuden 	u_int16_t	descSize;	/* driver size in blocks */
    119      1.4  wrstuden 	u_int16_t	descType;	/* system type */
    120      1.4  wrstuden };
    121      1.4  wrstuden 
    122      1.4  wrstuden /* system types; Apple reserves 0-15 */
    123      1.4  wrstuden #define	DRVR_TYPE_MACINTOSH	1
    124      1.4  wrstuden 
    125      1.4  wrstuden struct drvr_map {
    126      1.4  wrstuden #define DRIVER_MAP_MAGIC	0x4552
    127      1.4  wrstuden 	u_int16_t	sbSig;		/* map signature */
    128      1.4  wrstuden 	u_int16_t	sbBlockSize;	/* block size of device */
    129      1.4  wrstuden 	u_int32_t	sbBlkCount;	/* number of blocks on device */
    130      1.4  wrstuden 	u_int16_t	sbDevType;	/* (used internally by ROM) */
    131      1.4  wrstuden 	u_int16_t	sbDevID;	/* (used internally by ROM) */
    132      1.4  wrstuden 	u_int32_t	sbData;		/* (used internally by ROM) */
    133      1.4  wrstuden 	u_int16_t	sbDrvrCount;	/* number of driver descriptors */
    134      1.4  wrstuden #define	DRVR_MAX_DESCRIPTORS	61
    135      1.4  wrstuden 	struct drvr_descriptor sb_dd[DRVR_MAX_DESCRIPTORS];
    136      1.4  wrstuden 	u_int16_t	pad[3];
    137      1.4  wrstuden } __attribute__ ((packed));
    138      1.4  wrstuden 
    139      1.4  wrstuden #define	ddBlock(N)	sb_dd[(N)].descBlock
    140      1.4  wrstuden #define	ddSize(N)	sb_dd[(N)].descSize
    141      1.4  wrstuden #define	ddType(N)	sb_dd[(N)].descType
    142      1.4  wrstuden 
    143      1.4  wrstuden /*
    144      1.4  wrstuden  * Partition map structure from Inside Macintosh: Devices, SCSI Manager
    145      1.4  wrstuden  * pp. 13-14.  The partition map always begins on physical block 1.
    146      1.4  wrstuden  *
    147      1.4  wrstuden  * With the exception of block 0, all blocks on the disk must belong to
    148      1.4  wrstuden  * exactly one partition.  The partition map itself belongs to a partition
    149      1.4  wrstuden  * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
    150      1.4  wrstuden  * other than available disk space.  The partition map is not necessarily
    151      1.4  wrstuden  * the first partition listed.
    152      1.4  wrstuden  */
    153      1.4  wrstuden struct part_map_entry {
    154      1.4  wrstuden #define PART_ENTRY_MAGIC	0x504d
    155      1.4  wrstuden 	u_int16_t	pmSig;		/* partition signature */
    156      1.4  wrstuden 	u_int16_t	pmSigPad;	/* (reserved) */
    157      1.4  wrstuden 	u_int32_t	pmMapBlkCnt;	/* number of blocks in partition map */
    158      1.4  wrstuden 	u_int32_t	pmPyPartStart;	/* first physical block of partition */
    159      1.4  wrstuden 	u_int32_t	pmPartBlkCnt;	/* number of blocks in partition */
    160      1.4  wrstuden 	char		pmPartName[32];	/* partition name */
    161      1.4  wrstuden 	char		pmPartType[32];	/* partition type */
    162      1.4  wrstuden 	u_int32_t	pmLgDataStart;	/* first logical block of data area */
    163      1.4  wrstuden 	u_int32_t	pmDataCnt;	/* number of blocks in data area */
    164      1.4  wrstuden 	u_int32_t	pmPartStatus;	/* partition status information */
    165      1.4  wrstuden 	u_int32_t	pmLgBootStart;	/* first logical block of boot code */
    166      1.4  wrstuden 	u_int32_t	pmBootSize;	/* size of boot code, in bytes */
    167      1.4  wrstuden 	u_int32_t	pmBootLoad;	/* boot code load address */
    168      1.4  wrstuden 	u_int32_t	pmBootLoad2;	/* (reserved) */
    169      1.4  wrstuden 	u_int32_t	pmBootEntry;	/* boot code entry point */
    170      1.4  wrstuden 	u_int32_t	pmBootEntry2;	/* (reserved) */
    171      1.4  wrstuden 	u_int32_t	pmBootCksum;	/* boot code checksum */
    172      1.4  wrstuden 	char		pmProcessor[16]; /* processor type (e.g. "68020") */
    173      1.4  wrstuden 	u_int8_t	pmBootArgs[128]; /* A/UX boot arguments */
    174      1.4  wrstuden 	u_int8_t	pad[248];	/* pad to end of block */
    175      1.4  wrstuden };
    176      1.4  wrstuden 
    177      1.4  wrstuden #define PART_TYPE_DRIVER	"APPLE_DRIVER"
    178      1.4  wrstuden #define PART_TYPE_DRIVER43	"APPLE_DRIVER43"
    179      1.4  wrstuden #define PART_TYPE_DRIVERATA	"APPLE_DRIVER_ATA"
    180      1.6  wrstuden #define PART_TYPE_DRIVERIOKIT	"APPLE_DRIVER_IOKIT"
    181      1.7      matt #define PART_TYPE_FWDRIVER	"APPLE_FWDRIVER"
    182      1.4  wrstuden #define PART_TYPE_FWB_COMPONENT	"FWB DRIVER COMPONENTS"
    183      1.5  wrstuden #define PART_TYPE_FREE		"APPLE_FREE"
    184      1.4  wrstuden #define PART_TYPE_MAC		"APPLE_HFS"
    185  1.7.8.3   nathanw #define PART_TYPE_APPLEUFS	"APPLE_UFS"
    186      1.4  wrstuden #define PART_TYPE_NETBSD	"NETBSD"
    187      1.5  wrstuden #define PART_TYPE_NBSD_PPCBOOT	"NETBSD/MACPPC"
    188  1.7.8.1   nathanw #define PART_TYPE_NBSD_68KBOOT	"NETBSD/MAC68K"
    189  1.7.8.1   nathanw #define PART_TYPE_PATCHES	"APPLE_PATCHES"
    190      1.4  wrstuden #define PART_TYPE_PARTMAP	"APPLE_PARTITION_MAP"
    191      1.4  wrstuden #define PART_TYPE_SCRATCH	"APPLE_SCRATCH"
    192  1.7.8.3   nathanw #define PART_TYPE_BOOT		"APPLE_BOOT"
    193  1.7.8.3   nathanw #define PART_TYPE_LOADER	"APPLE_LOADER"
    194      1.4  wrstuden #define PART_TYPE_UNIX		"APPLE_UNIX_SVR2"
    195  1.7.8.3   nathanw #define PART_TYPE_LINUX	"LINUX"
    196  1.7.8.3   nathanw #define PART_TYPE_LINUX_SWAP	"LINUX_SWAP"
    197      1.4  wrstuden 
    198      1.4  wrstuden /*
    199      1.4  wrstuden  * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
    200      1.4  wrstuden  * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
    201      1.4  wrstuden  */
    202      1.4  wrstuden struct blockzeroblock {
    203      1.4  wrstuden 	u_int32_t       bzbMagic;
    204      1.4  wrstuden 	u_int8_t        bzbCluster;
    205      1.4  wrstuden 	u_int8_t        bzbType;
    206      1.4  wrstuden 	u_int16_t       bzbBadBlockInode;
    207      1.4  wrstuden 	u_int16_t       bzbFlags;
    208      1.4  wrstuden 	u_int16_t       bzbReserved;
    209      1.4  wrstuden 	u_int32_t       bzbCreationTime;
    210      1.4  wrstuden 	u_int32_t       bzbMountTime;
    211      1.4  wrstuden 	u_int32_t       bzbUMountTime;
    212      1.4  wrstuden };
    213  1.7.8.1   nathanw #define bzbFSType	bzbType
    214  1.7.8.1   nathanw #define bzbFrag		bzbCluster
    215  1.7.8.1   nathanw #define bzbCPG		bzbBadBlockInode	/* Also sgs for LFS */
    216  1.7.8.1   nathanw #define bzbFSize	bzbCreationTime
    217      1.4  wrstuden 
    218      1.5  wrstuden /* Apple occasionally changes these */
    219      1.4  wrstuden #define BZB_MAGIC	0xABADBABE
    220      1.4  wrstuden #define BZB_TYPEFS	1
    221      1.4  wrstuden #define BZB_TYPESWAP	3
    222      1.4  wrstuden #define BZB_ROOTFS	0x8000
    223      1.4  wrstuden #define BZB_USRFS	0x4000
    224      1.5  wrstuden #define BZB_USRFS_NEW	0x0004
    225      1.1    tsubai 
    226      1.1    tsubai #ifdef	_KERNEL
    227      1.1    tsubai struct disklabel;
    228      1.1    tsubai int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel));
    229      1.1    tsubai #endif	/* _KERNEL */
    230      1.1    tsubai 
    231      1.1    tsubai #endif	/* _MACHINE_DISKLABEL_H_ */
    232