gpt: Add compile time asserts for guid and gpt_partentry sizes

With new alignment specification it's easy to screw up. Fortunately if it
happens the size will be bigger than intended. Compile time assert will catch
this.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Vladimir Serbinenko 2023-08-13 09:18:53 +02:00
parent 7de6fe9635
commit 64e3cee72a

View File

@ -229,6 +229,9 @@ static struct grub_partition_map grub_gpt_partition_map =
GRUB_MOD_INIT(part_gpt)
{
COMPILE_TIME_ASSERT(sizeof(grub_guid_t) == 16);
COMPILE_TIME_ASSERT(sizeof(grub_packed_guid_t) == 16);
COMPILE_TIME_ASSERT(sizeof(struct grub_gpt_partentry) == 128);
grub_partition_map_register (&grub_gpt_partition_map);
}