comparison dstep/coreservices/osservices/AppleDiskPartitions.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
comparison
equal deleted inserted replaced
10:27e00625790b 11:07194b026fa4
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Jul 22, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.coreservices.osservices.AppleDiskPartitions;
8
9 //import dstep.AvailabilityMacros;
10 import dstep.coreservices.carboncore.MacTypes;
11 import dstep.internal.Version;
12 import dstep.objc.bridge.TypeEncoding;
13
14
15 // This is needed otherwise the enums will fail compiling with gdc
16 version (GNU)
17 {
18 private
19 {
20 const __kPatchDriverSignature = getOSType!("ptDR");
21 const __kATADriverSignature = getOSType!("wiki");
22 const __kSCSICDDriverSignature = getOSType!("CDvr");
23 const __kATAPIDriverSignature = getOSType!("ATPI");
24 const __kDriveSetupHFSSignature = getOSType!("DSU1");
25 }
26 }
27
28 enum
29 {
30 sbSIGWord = 0x4552,
31 sbMac = 1
32 }
33
34 enum
35 {
36 pMapSIG = 0x504D,
37 pdSigWord = 0x5453,
38 oldPMSigWord = pdSigWord,
39 newPMSigWord = pMapSIG
40 }
41
42 enum
43 {
44 kDriverTypeMacSCSI = 0x0001,
45 kDriverTypeMacATA = 0x0701,
46 kDriverTypeMacSCSIChained = 0xFFFF,
47 kDriverTypeMacATAChained = 0xF8FF
48 }
49
50 static if (D_LP64)
51 {
52 enum : long
53 {
54 kPartitionAUXIsValid = 0x00000001,
55 kPartitionAUXIsAllocated = 0x00000002,
56 kPartitionAUXIsInUse = 0x00000004,
57 kPartitionAUXIsBootValid = 0x00000008,
58 kPartitionAUXIsReadable = 0x00000010,
59 kPartitionAUXIsWriteable = 0x00000020,
60 kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
61 kPartitionIsWriteable = 0x00000020,
62 kPartitionIsMountedAtStartup = 0x40000000,
63 kPartitionIsStartup = 0x80000000,
64 kPartitionIsChainCompatible = 0x00000100,
65 kPartitionIsRealDeviceDriver = 0x00000200,
66 kPartitionCanChainToNext = 0x00000400
67 }
68 }
69
70 else
71 {
72 enum
73 {
74 kPartitionAUXIsValid = 0x00000001,
75 kPartitionAUXIsAllocated = 0x00000002,
76 kPartitionAUXIsInUse = 0x00000004,
77 kPartitionAUXIsBootValid = 0x00000008,
78 kPartitionAUXIsReadable = 0x00000010,
79 kPartitionAUXIsWriteable = 0x00000020,
80 kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
81 kPartitionIsWriteable = 0x00000020,
82 kPartitionIsMountedAtStartup = 0x40000000,
83 kPartitionIsStartup = 0x80000000,
84 kPartitionIsChainCompatible = 0x00000100,
85 kPartitionIsRealDeviceDriver = 0x00000200,
86 kPartitionCanChainToNext = 0x00000400
87 }
88 }
89
90 enum
91 {
92 kPatchDriverSignature = getOSType!("ptDR"),
93 kSCSIDriverSignature = 0x00010600,
94 kATADriverSignature = getOSType!("wiki"),
95 kSCSICDDriverSignature = getOSType!("CDvr"),
96 kATAPIDriverSignature = getOSType!("ATPI"),
97 kDriveSetupHFSSignature = getOSType!("DSU1")
98 }
99
100 struct Block0
101 {
102 ushort sbSig;
103 ushort sbBlkSize;
104 uint sbBlkCount;
105 ushort sbDevType;
106 ushort sbDevId;
107 uint sbData;
108 ushort sbDrvrCount;
109 uint ddBlock;
110 ushort ddSize;
111 ushort ddType;
112 UInt16* ddPad;
113 }
114
115
116 struct DDMap
117 {
118 uint ddBlock;
119 ushort ddSize;
120 ushort ddType;
121 }
122
123
124 struct Partition
125 {
126 ushort pmSig;
127 ushort pmSigPad;
128 uint pmMapBlkCnt;
129 uint pmPyPartStart;
130 uint pmPartBlkCnt;
131 char* pmPartName;
132 char* pmParType;
133 uint pmLgDataStart;
134 uint pmDataCnt;
135 uint pmPartStatus;
136 uint pmLgBootStart;
137 uint pmBootSize;
138 uint pmBootAddr;
139 uint pmBootAddr2;
140 uint pmBootEntry;
141 uint pmBootEntry2;
142 uint pmBootCksum;
143 char* pmProcessor;
144 UInt16* pmPad;
145 }
146