1 /* 2 ** mac_label.h: defines Macintosh partition maps and label 3 ** 4 ** Taken from "mkisofs 1.05 PLUS" by Andy Polyakov <appro@fy.chalmers.se> 5 ** (see http://fy.chalmers.se/~appro/mkisofs_plus.html for details) 6 ** 7 ** Much of this is already defined in the libhfs code, but to keep 8 ** things simple we stick with these. 9 */ 10 11 #ifndef __MAC_LABEL__ 12 #define __MAC_LABEL__ 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 /* Driver Descriptor Map */ 19 #define sbSigMagic "ER" 20 struct MacLabel { 21 unsigned char sbSig[2]; /* unique value for SCSI block 0 */ 22 unsigned char sbBlkSize[2]; /* block size of device */ 23 unsigned char sbBlkCount[4]; /* number of blocks on device */ 24 unsigned char sbDevType[2]; /* device type */ 25 unsigned char sbDevId[2]; /* device id */ 26 unsigned char sbData[4]; /* not used */ 27 unsigned char sbDrvrCount[2]; /* driver descriptor count */ 28 unsigned char ddBlock[4]; /* 1st driver's starting block */ 29 unsigned char ddSize[2]; /* size of 1st driver (512-byte blks) */ 30 unsigned char ddType[2]; /* system type (1 for Mac+) */ 31 unsigned char ddPad[486]; /* ARRAY[0..242] OF INTEGER; not used */ 32 }; 33 typedef struct MacLabel MacLabel; 34 35 #define IS_MAC_LABEL(d) (((MacLabel*)(d))->sbSig[0]=='E'&&((MacLabel*)(d))->sbSig[1]=='R') 36 37 /* Partition Map Entry */ 38 #define pmSigMagic "PM" 39 40 #define pmPartType_1 "Apple_partition_map" 41 # define pmPartName_11 "Apple" 42 43 #define pmPartType_2 "Apple_Driver" 44 #define pmPartType_21 "Apple_Driver43" 45 46 #define pmPartType_3 "Apple_UNIX_SVR2" 47 # define pmPartName_31 "A/UX Root" 48 # define pmPartName_32 "A/UX Usr" 49 # define pmPartName_33 "Random A/UX fs" 50 # define pmPartName_34 "Swap" 51 52 #define pmPartType_4 "Apple_HFS" 53 # define pmPartName_41 "MacOS" 54 55 #define pmPartType_5 "Apple_Free" 56 # define pmPartName_51 "Extra" 57 58 #define PM2 2 59 #define PM4 4 60 61 struct MacPart { 62 unsigned char pmSig[2]; /* unique value for map entry blk */ 63 unsigned char pmSigPad[2]; /* currently unused */ 64 unsigned char pmMapBlkCnt[4]; /* # of blks in partition map */ 65 unsigned char pmPyPartStart[4];/* physical start blk of partition */ 66 unsigned char pmPartBlkCnt[4];/* # of blks in this partition */ 67 unsigned char pmPartName[32]; /* ASCII partition name */ 68 unsigned char pmPartType[32]; /* ASCII partition type */ 69 unsigned char pmLgDataStart[4];/* log. # of partition's 1st data blk */ 70 unsigned char pmDataCnt[4]; /* # of blks in partition's data area */ 71 unsigned char pmPartStatus[4];/* bit field for partition status */ 72 unsigned char pmLgBootStart[4];/* log. blk of partition's boot code */ 73 unsigned char pmBootSize[4]; /* number of bytes in boot code */ 74 unsigned char pmBootAddr[4]; /* memory load address of boot code */ 75 unsigned char pmBootAddr2[4]; /* currently unused */ 76 unsigned char pmBootEntry[4]; /* entry point of boot code */ 77 unsigned char pmBootEntry2[4];/* currently unused */ 78 unsigned char pmBootCksum[4]; /* checksum of boot code */ 79 unsigned char pmProcessor[16];/* ASCII for the processor type */ 80 unsigned char pmPad[376]; /* ARRAY[0..187] OF INTEGER; not used */ 81 }; 82 typedef struct MacPart MacPart; 83 84 #define IS_MAC_PART(d) (((MacPart*)(d))->pmSig[0]=='P'&&((MacPart*)(d))->pmSig[1]=='M') 85 86 #define PM_STAT_VALID 0x01 /* Set if a valid partition map entry */ 87 #define PM_STAT_ALLOC 0x02 /* Set if partition is already allocated; clear if available */ 88 #define PM_STAT_INUSE 0x04 /* Set if partition is in use; may be cleared after a system reset */ 89 #define PM_STAT_BOOTABLE 0x08 /* Set if partition contains valid boot information */ 90 #define PM_STAT_READABLE 0x10 /* Set if partition allows reading */ 91 #define PM_STAT_WRITABLE 0x20 /* Set if partition allows writing */ 92 #define PM_STAT_BOOT_PIC 0x40 /* Set if boot code is position-independent */ 93 #define PM_STAT_UNUSED 0x80 /* Unused */ 94 #define PM_STAT_DEFAULT PM_STAT_VALID|PM_STAT_ALLOC|PM_STAT_READABLE|PM_STAT_WRITABLE 95 96 typedef struct { 97 char *name; /* Partition name */ 98 char *type; /* Partition type */ 99 int ntype; /* Partition type (numeric) */ 100 int start; /* start extent (SECTOR_SIZE blocks) */ 101 int size; /* extents (SECTOR_SIZE blocks) */ 102 } mac_partition_table; 103 104 /* from libhfs */ 105 #define HFS_BB_SIGWORD 0x4c4b 106 107 /* borrowed from write.c - we just need parts of this */ 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif /* __MAC_LABEL__ */ 114