diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/coreservices/osservices/AppleDiskPartitions.d	Sat Aug 01 15:03:28 2009 +0200
@@ -0,0 +1,146 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Jul 22, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.coreservices.osservices.AppleDiskPartitions;
+
+//import dstep.AvailabilityMacros;
+import dstep.coreservices.carboncore.MacTypes;
+import dstep.internal.Version;
+import dstep.objc.bridge.TypeEncoding;
+
+
+// This is needed otherwise the enums will fail compiling with gdc
+version (GNU)
+{
+	private
+	{
+		const __kPatchDriverSignature = getOSType!("ptDR");
+		const __kATADriverSignature = getOSType!("wiki");
+		const __kSCSICDDriverSignature = getOSType!("CDvr");
+		const __kATAPIDriverSignature = getOSType!("ATPI");
+		const __kDriveSetupHFSSignature = getOSType!("DSU1");
+	}
+}
+
+enum
+{
+	sbSIGWord = 0x4552,
+	sbMac = 1
+}
+
+enum
+{
+	pMapSIG = 0x504D,
+	pdSigWord = 0x5453,
+	oldPMSigWord = pdSigWord,
+	newPMSigWord = pMapSIG
+}
+
+enum
+{
+	kDriverTypeMacSCSI = 0x0001,
+	kDriverTypeMacATA = 0x0701,
+	kDriverTypeMacSCSIChained = 0xFFFF,
+	kDriverTypeMacATAChained = 0xF8FF
+}
+
+static if (D_LP64)
+{
+	enum : long
+	{
+		kPartitionAUXIsValid = 0x00000001,
+		kPartitionAUXIsAllocated = 0x00000002,
+		kPartitionAUXIsInUse = 0x00000004,
+		kPartitionAUXIsBootValid = 0x00000008,
+		kPartitionAUXIsReadable = 0x00000010,
+		kPartitionAUXIsWriteable = 0x00000020,
+		kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
+		kPartitionIsWriteable = 0x00000020,
+		kPartitionIsMountedAtStartup = 0x40000000,
+		kPartitionIsStartup = 0x80000000,
+		kPartitionIsChainCompatible = 0x00000100,
+		kPartitionIsRealDeviceDriver = 0x00000200,
+		kPartitionCanChainToNext = 0x00000400
+	}
+}
+
+else
+{
+	enum
+	{
+		kPartitionAUXIsValid = 0x00000001,
+		kPartitionAUXIsAllocated = 0x00000002,
+		kPartitionAUXIsInUse = 0x00000004,
+		kPartitionAUXIsBootValid = 0x00000008,
+		kPartitionAUXIsReadable = 0x00000010,
+		kPartitionAUXIsWriteable = 0x00000020,
+		kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
+		kPartitionIsWriteable = 0x00000020,
+		kPartitionIsMountedAtStartup = 0x40000000,
+		kPartitionIsStartup = 0x80000000,
+		kPartitionIsChainCompatible = 0x00000100,
+		kPartitionIsRealDeviceDriver = 0x00000200,
+		kPartitionCanChainToNext = 0x00000400
+	}
+}
+
+enum
+{
+	kPatchDriverSignature = getOSType!("ptDR"),
+	kSCSIDriverSignature = 0x00010600,
+	kATADriverSignature = getOSType!("wiki"),
+	kSCSICDDriverSignature = getOSType!("CDvr"),
+	kATAPIDriverSignature = getOSType!("ATPI"),
+	kDriveSetupHFSSignature = getOSType!("DSU1")
+}
+
+struct Block0
+{
+	ushort sbSig;
+	ushort sbBlkSize;
+	uint sbBlkCount;
+	ushort sbDevType;
+	ushort sbDevId;
+	uint sbData;
+	ushort sbDrvrCount;
+	uint ddBlock;
+	ushort ddSize;
+	ushort ddType;
+	UInt16* ddPad;
+}
+
+
+struct DDMap
+{
+	uint ddBlock;
+	ushort ddSize;
+	ushort ddType;
+}
+
+
+struct Partition
+{
+	ushort pmSig;
+	ushort pmSigPad;
+	uint pmMapBlkCnt;
+	uint pmPyPartStart;
+	uint pmPartBlkCnt;
+	char* pmPartName;
+	char* pmParType;
+	uint pmLgDataStart;
+	uint pmDataCnt;
+	uint pmPartStatus;
+	uint pmLgBootStart;
+	uint pmBootSize;
+	uint pmBootAddr;
+	uint pmBootAddr2;
+	uint pmBootEntry;
+	uint pmBootEntry2;
+	uint pmBootCksum;
+	char* pmProcessor;
+	UInt16* pmPad;
+}
+