blob: 1534a52c38a02eeaf963908ffb00011f7c4f9194 [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>
srs5694fed16d02010-01-27 23:03:40 -05007#include <string>
srs5694e7b4ff92009-08-18 13:16:10 -04008#include "support.h"
9
10#ifndef __PARTITION_TYPES
11#define __PARTITION_TYPES
12
srs5694e7b4ff92009-08-18 13:16:10 -040013using 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;
srs5694e321d442010-01-29 17:44:04 -050022 string name;
srs5694e7b4ff92009-08-18 13:16:10 -040023 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,
srs5694e321d442010-01-29 17:44:04 -050036 const char * name, int toDisplay = 1);
srs5694e7b4ff92009-08-18 13:16:10 -040037 void ShowTypes(void);
38 int Valid(uint16_t);
srs5694fed16d02010-01-27 23:03:40 -050039 string GUIDToName(struct GUIDData typeCode);
srs5694e7b4ff92009-08-18 13:16:10 -040040 struct GUIDData IDToGUID(uint16_t ID);
41 uint16_t GUIDToID(struct GUIDData);
42};
43
44#endif