summaryrefslogtreecommitdiff
path: root/parttypes.h
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2009-08-18 13:16:10 -0400
committersrs5694 <srs5694@users.sourceforge.net>2009-08-18 13:16:10 -0400
commite7b4ff9317fc4e551cf974684eaa88697de5a28d (patch)
tree5b5cc2b2fdce62960d03ad537f151df8c581902e /parttypes.h
downloadsgdisk-e7b4ff9317fc4e551cf974684eaa88697de5a28d.tar.gz
Initial git repository creation, version 0.3.1 plus changes
Diffstat (limited to 'parttypes.h')
-rw-r--r--parttypes.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/parttypes.h b/parttypes.h
new file mode 100644
index 0000000..ad62027
--- /dev/null
+++ b/parttypes.h
@@ -0,0 +1,44 @@
+#include <stdint.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string>
+#include "support.h"
+
+#ifndef __PARTITION_TYPES
+#define __PARTITION_TYPES
+
+// Set the size of the name string
+#define PNAME_SIZE 80
+
+using namespace std;
+
+// A partition type
+struct AType {
+ // I'm using a custom 16-bit extension of the original MBR 8-bit
+ // type codes, so as to permit disambiguation and use of new
+ // codes required by GPT
+ uint16_t MBRType;
+ struct GUIDData GUIDType;
+ char name[PNAME_SIZE];
+ int display; // 1 to show to users as available type, 0 not to
+ AType* next;
+}; // struct AType
+
+class PartTypes {
+protected:
+ static int numInstances;
+ static AType* allTypes; // Linked list holding all the data
+ static AType* lastType; // Pointer to last entry in the list
+public:
+ PartTypes(void);
+ ~PartTypes(void);
+ int AddType(uint16_t mbrType, uint64_t guidData1, uint64_t guidData2,
+ const char* name, int toDisplay = 1);
+ void ShowTypes(void);
+ int Valid(uint16_t);
+ char* GUIDToName(struct GUIDData typeCode, char typeName[]);
+ struct GUIDData IDToGUID(uint16_t ID);
+ uint16_t GUIDToID(struct GUIDData);
+};
+
+#endif