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