forked from bottlerocket-os/bottlerocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0003-gpt-rename-misnamed-header-location-fields.patch
71 lines (68 loc) · 3.1 KB
/
0003-gpt-rename-misnamed-header-location-fields.patch
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 7bf95046b9123cd7d57df6dee81cbbd75ca722f6 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
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 a308e85..705bd77 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 8cffe16..1101d85 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 a824cd9..4d70868 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,
--
2.21.3