aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpt.h')
-rw-r--r--src/gpt.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/gpt.h b/src/gpt.h
index 80742ea..5f1857c 100644
--- a/src/gpt.h
+++ b/src/gpt.h
@@ -1,15 +1,12 @@
-#define PACKED __attribute__((packed))
-#define TYPE_EMPTY "00000000-0000-0000-0000-000000000000"
-#define TYPE_SYSTEM "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
-
-typedef PACKED struct
-{
- uint8_t d[16];
-} GUID;
+#define GUID_TYPE_EMPTY MAKE_GUID(0,0,0,0,0)
+#define GUID_TYPE_SYSTEM MAKE_GUID(C12A7328,F81F,11D2,BA4B,00A0C93EC93B)
+#define GUID_TYPE_LINUX_EXT3 MAKE_GUID(EBD0A0A2,B9E5,4433,87C0,68B6B72699C7)
+#define GUID_TYPE_LINUX_SWAP MAKE_GUID(0657FD6D,A4AB,43C4,84E5,0933C84B4F4F)
+#define GUID_TYPE_APPLE_HFS MAKE_GUID(48465300,0000,11AA,AA11,00306543ECAC)
#define GPT_ENTRY_FLAG_SYSTEM 1
-typedef PACKED struct
+typedef struct
{
GUID type;
GUID label;
@@ -17,12 +14,12 @@ typedef PACKED struct
uint64_t end;
uint64_t flags;
uint8_t name[72];
-} GPT_entry;
+} PACKED GPT_entry;
#define GPT_HEADER_SIGNATURE "EFI PART"
#define GPT_HEADER_REVISION_EFI10 0x00010000
-typedef PACKED struct
+typedef struct
{
uint8_t signature[8];
uint32_t revision;
@@ -38,7 +35,7 @@ typedef PACKED struct
uint32_t n_partition_entries;
uint32_t partition_entry_size;
uint32_t partition_entry_crc;
-} GPT_header;
+} PACKED GPT_header;
@@ -46,14 +43,14 @@ typedef PACKED struct
#define MBR_PARTITION_TYPE_EFI 0xee
#define MBR_PARTITION_BOOTABLE 0x80
-typedef PACKED struct
+typedef struct
{
uint8_t head;
uint8_t sector;
uint8_t track;
-} CHS;
+} PACKED CHS;
-typedef PACKED struct
+typedef struct
{
uint8_t bootable;
CHS chs_start;
@@ -61,13 +58,13 @@ typedef PACKED struct
CHS chs_end;
uint32_t start;
uint32_t size;
-} MBR_entry;
+} PACKED MBR_entry;
-typedef PACKED struct
+typedef struct
{
uint8_t boot_code[440];
uint8_t uid[4];
uint8_t reserved[2];
MBR_entry entry[4];
uint8_t signature[2];
-} MBR;
+} PACKED MBR;