blob: ad62027604cea35fb3c87b4f217d5b667462e6ef [file] [log] [blame]
srs5694e7b4ff92009-08-18 13:16:10 -04001#include <stdint.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <string>
5#include "support.h"
6
7#ifndef __PARTITION_TYPES
8#define __PARTITION_TYPES
9
10// Set the size of the name string
11#define PNAME_SIZE 80
12
13using namespace std;
14
15// A partition type
16struct AType {
17 // I'm using a custom 16-bit extension of the original MBR 8-bit
18 // type codes, so as to permit disambiguation and use of new
19 // codes required by GPT
20 uint16_t MBRType;
21 struct GUIDData GUIDType;
22 char name[PNAME_SIZE];
23 int display; // 1 to show to users as available type, 0 not to
24 AType* next;
25}; // struct AType
26
27class PartTypes {
28protected:
29 static int numInstances;
30 static AType* allTypes; // Linked list holding all the data
31 static AType* lastType; // Pointer to last entry in the list
32public:
33 PartTypes(void);
34 ~PartTypes(void);
35 int AddType(uint16_t mbrType, uint64_t guidData1, uint64_t guidData2,
36 const char* name, int toDisplay = 1);
37 void ShowTypes(void);
38 int Valid(uint16_t);
39 char* GUIDToName(struct GUIDData typeCode, char typeName[]);
40 struct GUIDData IDToGUID(uint16_t ID);
41 uint16_t GUIDToID(struct GUIDData);
42};
43
44#endif