gpt: add a new generic GUID type
In order to do anything with partition GUIDs they need to be stored in a proper structure like the partition type GUIDs. Additionally add an initializer macro to simplify defining both GUID types.
This commit is contained in:
parent
7ed934533c
commit
6278c3e75f
2 changed files with 25 additions and 23 deletions
|
@ -23,33 +23,35 @@
|
|||
#include <grub/partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
|
||||
struct grub_gpt_part_type
|
||||
struct grub_gpt_guid
|
||||
{
|
||||
grub_uint32_t data1;
|
||||
grub_uint16_t data2;
|
||||
grub_uint16_t data3;
|
||||
grub_uint8_t data4[8];
|
||||
} __attribute__ ((aligned(8)));
|
||||
typedef struct grub_gpt_part_type grub_gpt_part_type_t;
|
||||
typedef struct grub_gpt_guid grub_gpt_guid_t;
|
||||
typedef struct grub_gpt_guid grub_gpt_part_type_t;
|
||||
|
||||
#define GRUB_GPT_GUID_INIT(a, b, c, d1, d2, d3, d4, d5, d6, d7, d8) \
|
||||
{ \
|
||||
grub_cpu_to_le32_compile_time (a), \
|
||||
grub_cpu_to_le16_compile_time (b), \
|
||||
grub_cpu_to_le16_compile_time (c), \
|
||||
{ d1, d2, d3, d4, d5, d6, d7, d8 } \
|
||||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_EMPTY \
|
||||
{ 0x0, 0x0, 0x0, \
|
||||
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \
|
||||
}
|
||||
GRUB_GPT_GUID_INIT (0x0, 0x0, 0x0, \
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
|
||||
{ grub_cpu_to_le32_compile_time (0x21686148), \
|
||||
grub_cpu_to_le16_compile_time (0x6449), \
|
||||
grub_cpu_to_le16_compile_time (0x6e6f), \
|
||||
{ 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
|
||||
}
|
||||
GRUB_GPT_GUID_INIT (0x21686148, 0x6449, 0x6e6f, \
|
||||
0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49)
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_LDM \
|
||||
{ grub_cpu_to_le32_compile_time (0x5808C8AAU),\
|
||||
grub_cpu_to_le16_compile_time (0x7E8F), \
|
||||
grub_cpu_to_le16_compile_time (0x42E0), \
|
||||
{ 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \
|
||||
}
|
||||
GRUB_GPT_GUID_INIT (0x5808c8aa, 0x7e8f, 0x42e0, \
|
||||
0x85, 0xd2, 0xe1, 0xe9, 0x04, 0x34, 0xcf, 0xb3)
|
||||
|
||||
#define GRUB_GPT_HEADER_MAGIC \
|
||||
{ 0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54 }
|
||||
|
@ -68,7 +70,7 @@ struct grub_gpt_header
|
|||
grub_uint64_t alternate_lba;
|
||||
grub_uint64_t start;
|
||||
grub_uint64_t end;
|
||||
grub_uint8_t guid[16];
|
||||
grub_gpt_guid_t guid;
|
||||
grub_uint64_t partitions;
|
||||
grub_uint32_t maxpart;
|
||||
grub_uint32_t partentry_size;
|
||||
|
@ -78,7 +80,7 @@ struct grub_gpt_header
|
|||
struct grub_gpt_partentry
|
||||
{
|
||||
grub_gpt_part_type_t type;
|
||||
grub_uint8_t guid[16];
|
||||
grub_gpt_guid_t guid;
|
||||
grub_uint64_t start;
|
||||
grub_uint64_t end;
|
||||
grub_uint64_t attrib;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue