New release: 0.4.0
This version adds support for FreeBSD and big-endian systems. It also
adds support for BSD disklabels and an assortment of other changes,
improvements, and bug fixes.
diff --git a/support.h b/support.h
index d0b3e57..d812d3c 100644
--- a/support.h
+++ b/support.h
@@ -1,8 +1,11 @@
+/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed
+ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
+
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
-#ifdef __APPLE__
+#if defined (__FreeBSD__) || defined (__APPLE__)
// Darwin (Mac OS) only: disk IOCTLs are different, and there is no lseek64
// This used to use __DARWIN_UNIX03 rather than __APPLE__, but __APPLE__
// is more general. If the code fails to work on older versions of OS X/
@@ -23,6 +26,23 @@
// Set this as a default
#define SECTOR_SIZE UINT32_C(512)
+// Signatures for Apple (APM) disks, multiplied by 0x100000000
+#define APM_SIGNATURE1 UINT64_C(0x00004D5000000000)
+#define APM_SIGNATURE2 UINT64_C(0x0000535400000000)
+
+/**************************
+ * Some GPT constants.... *
+ **************************/
+
+#define GPT_SIGNATURE UINT64_C(0x5452415020494645)
+
+// Number and size of GPT entries...
+#define NUM_GPT_ENTRIES 128
+#define GPT_SIZE 128
+#define HEADER_SIZE 92
+#define GPT_RESERVED 420
+#define NAME_SIZE 72
+
using namespace std;
// a GUID
@@ -39,7 +59,7 @@
char* GUIDToStr(struct GUIDData theGUID, char* theString);
GUIDData GetGUID(void);
int IsLittleEndian(void); // Returns 1 if CPU is little-endian, 0 if it's big-endian
-void ReverseBytes(char* theValue, int numBytes); // Reverses byte-order of theValue
+void ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue
uint64_t PowerOf2(int value);
uint64_t disksize(int fd, int* err);