summaryrefslogtreecommitdiff
path: root/common/quicktime_win32/AppleDiskPartitions.h
blob: 1927da171677e9f80b972f01c24448894259549a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
     File:       AppleDiskPartitions.h
 
     Contains:   The Apple disk partition scheme as defined in Inside Macintosh: Volume V.
 
     Version:    QuickTime 7.3
 
     Copyright:  (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved
 
     Bugs?:      For bug reports, consult the following page on
                 the World Wide Web:
 
                     http://developer.apple.com/bugreporter/
 
*/
#ifndef __APPLEDISKPARTITIONS__
#define __APPLEDISKPARTITIONS__

#ifndef __MACTYPES__
#include <MacTypes.h>
#endif




#if PRAGMA_ONCE
#pragma once
#endif

#if PRAGMA_IMPORT
#pragma import on
#endif

#if PRAGMA_STRUCT_ALIGN
    #pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
    #pragma pack(2)
#endif

/* Block 0 Definitions */
enum {
  sbSIGWord                     = 0x4552, /* signature word for Block 0 ('ER') */
  sbMac                         = 1     /* system type for Mac */
};

/* Partition Map Signatures */
enum {
  pMapSIG                       = 0x504D, /* partition map signature ('PM') */
  pdSigWord                     = 0x5453, /* partition map signature ('TS') */
  oldPMSigWord                  = pdSigWord,
  newPMSigWord                  = pMapSIG
};


/* Driver Descriptor Map */
struct Block0 {
  UInt16              sbSig;                  /* unique value for SCSI block 0 */
  UInt16              sbBlkSize;              /* block size of device */
  UInt32              sbBlkCount;             /* number of blocks on device */
  UInt16              sbDevType;              /* device type */
  UInt16              sbDevId;                /* device id */
  UInt32              sbData;                 /* not used */
  UInt16              sbDrvrCount;            /* driver descriptor count */
  UInt32              ddBlock;                /* 1st driver's starting block */
  UInt16              ddSize;                 /* size of 1st driver (512-byte blks) */
  UInt16              ddType;                 /* system type (1 for Mac+) */
  UInt16              ddPad[243];             /* ARRAY[0..242] OF INTEGER; not used */
};
typedef struct Block0                   Block0;
/* Driver descriptor */
struct DDMap {
  UInt32              ddBlock;                /* 1st driver's starting block */
  UInt16              ddSize;                 /* size of 1st driver (512-byte blks) */
  UInt16              ddType;                 /* system type (1 for Mac+) */
};
typedef struct DDMap                    DDMap;
/* Constants for the ddType field of the DDMap structure. */
enum {
  kDriverTypeMacSCSI            = 0x0001,
  kDriverTypeMacATA             = 0x0701,
  kDriverTypeMacSCSIChained     = 0xFFFF,
  kDriverTypeMacATAChained      = 0xF8FF
};

/* Partition Map Entry */
struct Partition {
  UInt16              pmSig;                  /* unique value for map entry blk */
  UInt16              pmSigPad;               /* currently unused */
  UInt32              pmMapBlkCnt;            /* # of blks in partition map */
  UInt32              pmPyPartStart;          /* physical start blk of partition */
  UInt32              pmPartBlkCnt;           /* # of blks in this partition */
  UInt8               pmPartName[32];         /* ASCII partition name */
  UInt8               pmParType[32];          /* ASCII partition type */
  UInt32              pmLgDataStart;          /* log. # of partition's 1st data blk */
  UInt32              pmDataCnt;              /* # of blks in partition's data area */
  UInt32              pmPartStatus;           /* bit field for partition status */
  UInt32              pmLgBootStart;          /* log. blk of partition's boot code */
  UInt32              pmBootSize;             /* number of bytes in boot code */
  UInt32              pmBootAddr;             /* memory load address of boot code */
  UInt32              pmBootAddr2;            /* currently unused */
  UInt32              pmBootEntry;            /* entry point of boot code */
  UInt32              pmBootEntry2;           /* currently unused */
  UInt32              pmBootCksum;            /* checksum of boot code */
  UInt8               pmProcessor[16];        /* ASCII for the processor type */
  UInt16              pmPad[188];             /* ARRAY[0..187] OF INTEGER; not used */
};
typedef struct Partition                Partition;

/* Flags for the pmPartStatus field of the Partition data structure. */
enum {
  kPartitionAUXIsValid          = 0x00000001,
  kPartitionAUXIsAllocated      = 0x00000002,
  kPartitionAUXIsInUse          = 0x00000004,
  kPartitionAUXIsBootValid      = 0x00000008,
  kPartitionAUXIsReadable       = 0x00000010,
  kPartitionAUXIsWriteable      = 0x00000020,
  kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
  kPartitionIsWriteable         = 0x00000020,
  kPartitionIsMountedAtStartup  = 0x40000000,
  kPartitionIsStartup           = (long)0x80000000,
  kPartitionIsChainCompatible   = 0x00000100,
  kPartitionIsRealDeviceDriver  = 0x00000200,
  kPartitionCanChainToNext      = 0x00000400
};




/* Well known driver signatures, stored in the first four byte of pmPad. */
enum {
  kPatchDriverSignature         = FOUR_CHAR_CODE('ptDR'), /* SCSI and ATA[PI] patch driver    */
  kSCSIDriverSignature          = 0x00010600, /* SCSI  hard disk driver           */
  kATADriverSignature           = FOUR_CHAR_CODE('wiki'), /* ATA   hard disk driver           */
  kSCSICDDriverSignature        = FOUR_CHAR_CODE('CDvr'), /* SCSI  CD-ROM    driver           */
  kATAPIDriverSignature         = FOUR_CHAR_CODE('ATPI'), /* ATAPI CD-ROM    driver           */
  kDriveSetupHFSSignature       = FOUR_CHAR_CODE('DSU1') /* Drive Setup HFS partition        */
};




#if PRAGMA_STRUCT_ALIGN
    #pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
    #pragma pack()
#endif

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif


#endif /* __APPLEDISKPARTITIONS__ */