aboutsummaryrefslogtreecommitdiffstats
path: root/block/partitions
diff options
context:
space:
mode:
Diffstat (limited to 'block/partitions')
-rw-r--r--block/partitions/efi.c9
-rw-r--r--block/partitions/efi.h16
2 files changed, 19 insertions, 6 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index c85fc895ecdb..bd8fb22b2109 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -149,12 +149,11 @@ static u64 last_lba(struct block_device *bdev)
149 bdev_logical_block_size(bdev)) - 1ULL; 149 bdev_logical_block_size(bdev)) - 1ULL;
150} 150}
151 151
152static inline int 152static inline int pmbr_part_valid(gpt_mbr_record *part)
153pmbr_part_valid(struct partition *part)
154{ 153{
155 if (part->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT && 154 if (part->os_type == EFI_PMBR_OSTYPE_EFI_GPT &&
156 le32_to_cpu(part->start_sect) == 1UL) 155 le32_to_cpu(part->start_sector) == 1UL)
157 return 1; 156 return 1;
158 return 0; 157 return 0;
159} 158}
160 159
diff --git a/block/partitions/efi.h b/block/partitions/efi.h
index b69ab729558f..e645ecb35bf3 100644
--- a/block/partitions/efi.h
+++ b/block/partitions/efi.h
@@ -101,11 +101,25 @@ typedef struct _gpt_entry {
101 efi_char16_t partition_name[72 / sizeof (efi_char16_t)]; 101 efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
102} __attribute__ ((packed)) gpt_entry; 102} __attribute__ ((packed)) gpt_entry;
103 103
104typedef struct _gpt_mbr_record {
105 u8 boot_indicator; /* unused by EFI, set to 0x80 for bootable */
106 u8 start_head; /* unused by EFI, pt start in CHS */
107 u8 start_sector; /* unused by EFI, pt start in CHS */
108 u8 start_track;
109 u8 os_type; /* EFI and legacy non-EFI OS types */
110 u8 end_head; /* unused by EFI, pt end in CHS */
111 u8 end_sector; /* unused by EFI, pt end in CHS */
112 u8 end_track; /* unused by EFI, pt end in CHS */
113 __le32 starting_lba; /* used by EFI - start addr of the on disk pt */
114 __le32 size_in_lba; /* used by EFI - size of pt in LBA */
115} __packed gpt_mbr_record;
116
117
104typedef struct _legacy_mbr { 118typedef struct _legacy_mbr {
105 u8 boot_code[440]; 119 u8 boot_code[440];
106 __le32 unique_mbr_signature; 120 __le32 unique_mbr_signature;
107 __le16 unknown; 121 __le16 unknown;
108 struct partition partition_record[4]; 122 gpt_mbr_record partition_record[4];
109 __le16 signature; 123 __le16 signature;
110} __attribute__ ((packed)) legacy_mbr; 124} __attribute__ ((packed)) legacy_mbr;
111 125