-
Notifications
You must be signed in to change notification settings - Fork 3
/
gpt.h
35 lines (30 loc) · 868 Bytes
/
gpt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef GPT_H
#define GPT_H
#include <stdint.h>
#define PRIMARY_GPT_HEADER_LBA 1
#define GPT_HEADER_SIGNATURE 0x5452415020494645
typedef struct {
uint64_t signature;
uint32_t revision;
uint32_t header_size;
uint32_t header_crc32;
uint32_t reserved;
uint64_t my_lba;
uint64_t alternate_lba;
uint64_t first_usable_lba;
uint64_t last_usable_lba;
uint8_t disk_guid[16];
uint64_t partition_entry_lba;
uint32_t number_of_partition_entries;
uint32_t size_of_partition_entry;
uint32_t partition_entry_array_crc32;
} __attribute__((packed)) gpt_header_t;
typedef struct {
uint8_t partition_type_guid[16];
uint8_t unique_partition_guid[16];
uint64_t starting_lba;
uint64_t ending_lba;
uint64_t attributes;
uint16_t partition_name[36];
} __attribute__((packed)) gpt_entry_t;
#endif //GPT_H