| 1 | /*	$OpenBSD: disklabel.h,v 1.16 2015/09/30 15:13:54 krw Exp $	*/ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1994 Christopher G. Demetriou |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. All advertising materials mentioning features or use of this software |
| 16 | * must display the following acknowledgement: |
| 17 | * This product includes software developed by Christopher G. Demetriou. |
| 18 | * 4. The name of the author may not be used to endorse or promote products |
| 19 | * derived from this software without specific prior written permission |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | #ifndef _MACHINE_DISKLABEL_H_ |
| 34 | #define _MACHINE_DISKLABEL_H_ |
| 35 | |
| 36 | #define	LABELSECTOR	1	/* sector containing label */ |
| 37 | #define	LABELOFFSET	0	/* offset of label in sector */ |
| 38 | #define	MAXPARTITIONS	16	/* number of partitions */ |
| 39 | |
| 40 | /* HFS/DPME */ |
| 41 | |
| 42 | /* partition map structure from Inside Macintosh: Devices, SCSI Manager |
| 43 | * pp. 13-14. The partition map always begins on physical block 1. |
| 44 | * |
| 45 | * With the exception of block 0, all blocks on the disk must belong to |
| 46 | * exactly one partition. The partition map itself belongs to a partition |
| 47 | * of type `APPLE_PARTITION_MAP', and is not limited in size by anything |
| 48 | * other than available disk space. The partition map is not necessarily |
| 49 | * the first partition listed. |
| 50 | */ |
| 51 | struct part_map_entry { |
| 52 | #define PART_ENTRY_MAGIC 0x504d |
| 53 | 	u_int16_t pmSig; /* partition signature */ |
| 54 | 	u_int16_t pmSigPad; /* (reserved) */ |
| 55 | 	u_int32_t pmMapBlkCnt; /* number of blocks in partition map */ |
| 56 | 	u_int32_t pmPyPartStart; /* first physical block of partition */ |
| 57 | 	u_int32_t pmPartBlkCnt; /* number of blocks in partition */ |
| 58 | 	char pmPartName[32]; /* partition name */ |
| 59 | 	char pmPartType[32]; /* partition type */ |
| 60 | 	u_int32_t pmLgDataStart; /* first logical block of data area */ |
| 61 | 	u_int32_t pmDataCnt; /* number of blocks in data area */ |
| 62 | 	u_int32_t pmPartStatus; /* partition status information */ |
| 63 | 	u_int32_t pmLgBootStart; /* first logical block of boot code */ |
| 64 | 	u_int32_t pmBootSize; /* size of boot code, in bytes */ |
| 65 | 	u_int32_t pmBootLoad; /* boot code load address */ |
| 66 | 	u_int32_t pmBootLoad2; /* (reserved) */ |
| 67 | 	u_int32_t pmBootEntry; /* boot code entry point */ |
| 68 | 	u_int32_t pmBootEntry2; /* (reserved) */ |
| 69 | 	u_int32_t pmBootCksum; /* boot code checksum */ |
| 70 | 	char pmProcessor[16]; /* processor type (e.g. "68020") */ |
| 71 | 	u_int8_t pmBootArgs[128]; /* A/UX boot arguments */ |
| 72 | 	/* we do not index the disk image as an array, |
| 73 | 	 * leave out the on disk padding |
| 74 | 	 */ |
| 75 | #if 0 |
| 76 | 	u_int8_t pad[248]; /* pad to end of block */ |
| 77 | #endif |
| 78 | }; |
| 79 | |
| 80 | #define PART_TYPE_DRIVER "APPLE_DRIVER" |
| 81 | #define PART_TYPE_DRIVER43 "APPLE_DRIVER43" |
| 82 | #define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA" |
| 83 | #define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT" |
| 84 | #define PART_TYPE_FWDRIVER "APPLE_FWDRIVER" |
| 85 | #define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS" |
| 86 | #define PART_TYPE_FREE "APPLE_FREE" |
| 87 | #define PART_TYPE_MAC "APPLE_HFS" |
| 88 | #define PART_TYPE_OPENBSD "OPENBSD" |
| 89 | |
| 90 | #endif /* _MACHINE_DISKLABEL_H_ */ |