20static const u8 EFI_PARTITION_SIGNATURE[8] = {
'E',
'F',
'I',
' ',
'P',
'A',
'R',
'T' };
22typedef struct __attribute__((packed)) _gpt_partition_table_header
34 u64 partition_table_lba;
36 u32 partition_entry_size;
37 u32 partition_table_checksum;
38} gpt_partition_table_header;
41static const u8 NULL_GUID[16] = { 0 };
42static const u8 MS_RESERVED_PARTITION_GUID[16] = { 0x16, 0xE3, 0xC9, 0xE3, 0x5C, 0x0B, 0xB8, 0x4D, 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE };
43static const u8 EFI_SYSTEM_PARTITION[16] = { 0x28, 0x73, 0x2A, 0xC1, 0x1F, 0xF8, 0xD2, 0x11, 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B };
44static const u8 MS_BASIC_DATA_PARTITION_GUID[16] = { 0xA2, 0xA0, 0xD0, 0xEB, 0xE5, 0xB9, 0x33, 0x44, 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 };
46typedef struct __attribute__((packed)) _gpt_partition_table_entry
48 u8 partition_type_guid[16];
49 u8 partition_unique_guid[16];
53 u16 partition_name[36];
54} gpt_partition_table_entry;
56#define GPT_PART_ATTR_PLATFORM_REQUIRED 0x1
57#define GPT_PART_ATTR_IGNORE 0x2
58#define GPT_PART_ATTR_LEGACY_BOOTABLE 0x4
60#define GPT_PART_ATTR_TYPE_SHIFT 48
61#define GPT_PART_ATTR_TYPE_MASK 0xFFFF
62#define GPT_PART_ATTR_TYPE_SPECIFIC(attr) ((attr >> GPT_PART_ATTR_TYPE_SHIFT) & GPT_PART_ATTR_TYPE_MASK)
65#define GPT_BDP_ATTR_READ_ONLY 0x1000
66#define GPT_BDP_ATTR_SHADOW_COPY 0x2000
67#define GPT_BDP_ATTR_HIDDEN 0x4000
68#define GPT_BDP_ATTR_NO_DRIVE_LETTER 0x8000