2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)mac_label.h 1.3 04/03/01 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
15 * Copyright (c) 1997, 1998, 1999, 2000 James Pearson
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2, or (at your option)
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; see the file COPYING. If not, write to
29 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
33 * mac_label.h: defines Macintosh partition maps and label
35 * Taken from "genisoimage 1.05 PLUS" by Andy Polyakov <appro@fy.chalmers.se>
36 * (see http://fy.chalmers.se/~appro/genisoimage_plus.html for details)
38 * Much of this is already defined in the libhfs code, but to keep
39 * things simple we stick with these.
50 struct fdiskPartition {
51 #define prepPartType 0x41
52 #define chrpPartType 0x96
53 unsigned char boot; /* bootable flag; not used */
54 unsigned char CHSstart[3]; /* start CHS; not used */
55 unsigned char type; /* Partition type, = 0x41 (PReP bootable) */
56 unsigned char CHSend[3]; /* end CHS; not used */
57 unsigned char startSect[4]; /* start sector (really start of boot image on CD */
58 unsigned char size[4]; /* size of partition (or boot image ;) ) */
60 typedef struct fdiskPartition fdiskPartition;
63 /* Driver Descriptor Map */
64 #define sbSigMagic "ER"
66 unsigned char sbSig[2]; /* unique value for SCSI block 0 */
67 unsigned char sbBlkSize[2]; /* block size of device */
68 unsigned char sbBlkCount[4]; /* number of blocks on device */
69 unsigned char sbDevType[2]; /* device type */
70 unsigned char sbDevId[2]; /* device id */
71 unsigned char sbData[4]; /* not used */
72 unsigned char sbDrvrCount[2]; /* driver descriptor count */
73 unsigned char ddBlock[4]; /* 1st driver's starting block */
74 unsigned char ddSize[2]; /* size of 1st driver (512-byte blks) */
75 unsigned char ddType[2]; /* system type (1 for Mac+) */
77 unsigned char ddPad[486]; /* ARRAY[0..242] OF INTEGER; not used */
79 #define fdiskMagic0 0x55
80 #define fdiskMagic1 0xAA
81 unsigned char pad1[420]; /* not used */
82 fdiskPartition image[4]; /* heh heh heh, we can have up to 4 */
83 /* different boot images */
84 unsigned char fdiskMagic[2]; /* PReP uses fdisk partition map */
85 #endif /* PREP_BOOT */
87 typedef struct MacLabel MacLabel;
89 #define IS_MAC_LABEL(d) (((MacLabel*)(d))->sbSig[0] == 'E' && \
90 ((MacLabel*)(d))->sbSig[1] == 'R')
92 /* Partition Map Entry */
93 #define pmSigMagic "PM"
95 #define pmPartType_1 "Apple_partition_map"
96 #define pmPartName_11 "Apple"
98 #define pmPartType_2 "Apple_Driver"
99 #define pmPartType_21 "Apple_Driver43"
101 #define pmPartType_3 "Apple_UNIX_SVR2"
102 #define pmPartName_31 "A/UX Root"
103 #define pmPartName_32 "A/UX Usr"
104 #define pmPartName_33 "Random A/UX fs"
105 #define pmPartName_34 "Swap"
107 #define pmPartType_4 "Apple_HFS"
108 #define pmPartName_41 "MacOS"
110 #define pmPartType_5 "Apple_Free"
111 #define pmPartName_51 "Extra"
117 unsigned char pmSig[2]; /* unique value for map entry blk */
118 unsigned char pmSigPad[2]; /* currently unused */
119 unsigned char pmMapBlkCnt[4]; /* # of blks in partition map */
120 unsigned char pmPyPartStart[4]; /* physical start blk of partition */
121 unsigned char pmPartBlkCnt[4]; /* # of blks in this partition */
122 unsigned char pmPartName[32]; /* ASCII partition name */
123 unsigned char pmPartType[32]; /* ASCII partition type */
124 unsigned char pmLgDataStart[4]; /* log. # of partition's 1st data blk */
125 unsigned char pmDataCnt[4]; /* # of blks in partition's data area */
126 unsigned char pmPartStatus[4]; /* bit field for partition status */
127 unsigned char pmLgBootStart[4]; /* log. blk of partition's boot code */
128 unsigned char pmBootSize[4]; /* number of bytes in boot code */
129 unsigned char pmBootAddr[4]; /* memory load address of boot code */
130 unsigned char pmBootAddr2[4]; /* currently unused */
131 unsigned char pmBootEntry[4]; /* entry point of boot code */
132 unsigned char pmBootEntry2[4]; /* currently unused */
133 unsigned char pmBootCksum[4]; /* checksum of boot code */
134 unsigned char pmProcessor[16]; /* ASCII for the processor type */
135 unsigned char pmPad[376]; /* ARRAY[0..187] OF INTEGER; not used */
137 typedef struct MacPart MacPart;
139 #define IS_MAC_PART(d) (((MacPart*)(d))->pmSig[0] == 'P' && \
140 ((MacPart*)(d))->pmSig[1] == 'M')
142 #define PM_STAT_VALID 0x01 /* Set if a valid partition map entry */
143 #define PM_STAT_ALLOC 0x02 /* Set if partition is already allocated; clear if available */
144 #define PM_STAT_INUSE 0x04 /* Set if partition is in use; may be cleared after a system reset */
145 #define PM_STAT_BOOTABLE 0x08 /* Set if partition contains valid boot information */
146 #define PM_STAT_READABLE 0x10 /* Set if partition allows reading */
147 #define PM_STAT_WRITABLE 0x20 /* Set if partition allows writing */
148 #define PM_STAT_BOOT_PIC 0x40 /* Set if boot code is position-independent */
149 #define PM_STAT_UNUSED 0x80 /* Unused */
150 #define PM_STAT_DEFAULT PM_STAT_VALID|PM_STAT_ALLOC|PM_STAT_READABLE|PM_STAT_WRITABLE
153 char *name; /* Partition name */
154 char *type; /* Partition type */
155 int ntype; /* Partition type (numeric) */
156 int start; /* start extent (SECTOR_SIZE blocks) */
157 int size; /* extents (SECTOR_SIZE blocks) */
158 } mac_partition_table;
161 #define HFS_BB_SIGWORD 0x4c4b
163 typedef struct deferred_write defer;
169 #endif /* _MAC_LABEL_H */