From 3b2674aef78723fb683591d04ba3e949a5f99905 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 18 Oct 2014 15:39:13 -0700 Subject: [PATCH] gpt: rename misnamed header location fields The header location fields refer to 'this header' and 'alternate header' respectively, not 'primary header' and 'backup header'. The previous field names are backwards for the backup header. --- grub-core/lib/gpt.c | 2 +- include/grub/gpt_partition.h | 4 ++-- tests/gpt_unit_test.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/grub-core/lib/gpt.c b/grub-core/lib/gpt.c index a308e8537..705bd77f9 100644 --- a/grub-core/lib/gpt.c +++ b/grub-core/lib/gpt.c @@ -137,7 +137,7 @@ grub_gpt_read_backup (grub_disk_t disk, grub_gpt_t gpt) if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN) sector = disk->total_sectors - 1; else if (gpt->status & GRUB_GPT_PRIMARY_HEADER_VALID) - sector = grub_le_to_cpu64 (gpt->primary.backup); + sector = grub_le_to_cpu64 (gpt->primary.alternate_lba); else return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "Unable to locate backup GPT"); diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h index 04ed2d7f1..a7ef61875 100644 --- a/include/grub/gpt_partition.h +++ b/include/grub/gpt_partition.h @@ -64,8 +64,8 @@ struct grub_gpt_header grub_uint32_t headersize; grub_uint32_t crc32; grub_uint32_t unused1; - grub_uint64_t primary; - grub_uint64_t backup; + grub_uint64_t header_lba; + grub_uint64_t alternate_lba; grub_uint64_t start; grub_uint64_t end; grub_uint8_t guid[16]; diff --git a/tests/gpt_unit_test.c b/tests/gpt_unit_test.c index a824cd967..4d70868af 100644 --- a/tests/gpt_unit_test.c +++ b/tests/gpt_unit_test.c @@ -94,8 +94,8 @@ static const struct grub_gpt_header example_primary = { .version = GRUB_GPT_HEADER_VERSION, .headersize = sizeof (struct grub_gpt_header), .crc32 = grub_cpu_to_le32_compile_time (0x7cd8642c), - .primary = grub_cpu_to_le64_compile_time (PRIMARY_HEADER_SECTOR), - .backup = grub_cpu_to_le64_compile_time (BACKUP_HEADER_SECTOR), + .header_lba = grub_cpu_to_le64_compile_time (PRIMARY_HEADER_SECTOR), + .alternate_lba = grub_cpu_to_le64_compile_time (BACKUP_HEADER_SECTOR), .start = grub_cpu_to_le64_compile_time (DATA_START_SECTOR), .end = grub_cpu_to_le64_compile_time (DATA_END_SECTOR), .guid = {0xad, 0x31, 0xc1, 0x69, 0xd6, 0x67, 0xc6, 0x46, @@ -112,8 +112,8 @@ static const struct grub_gpt_header example_backup = { .version = GRUB_GPT_HEADER_VERSION, .headersize = sizeof (struct grub_gpt_header), .crc32 = grub_cpu_to_le32_compile_time (0xcfaa4a27), - .primary = grub_cpu_to_le64_compile_time (BACKUP_HEADER_SECTOR), - .backup = grub_cpu_to_le64_compile_time (PRIMARY_HEADER_SECTOR), + .header_lba = grub_cpu_to_le64_compile_time (BACKUP_HEADER_SECTOR), + .alternate_lba = grub_cpu_to_le64_compile_time (PRIMARY_HEADER_SECTOR), .start = grub_cpu_to_le64_compile_time (DATA_START_SECTOR), .end = grub_cpu_to_le64_compile_time (DATA_END_SECTOR), .guid = {0xad, 0x31, 0xc1, 0x69, 0xd6, 0x67, 0xc6, 0x46,