summaryrefslogtreecommitdiff
path: root/block/partitions/efi.c
diff options
context:
space:
mode:
authorDavidlohr Bueso <davidlohr@hp.com>2013-09-11 14:24:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:59:15 -0700
commitc2ebdc2439f50c049fd362bb225aaf78fe8e4cb8 (patch)
tree84e531378486eacbce73be8426c657b73457908f /block/partitions/efi.c
parent6f79d33228fa7cf900826738a39f287cae96cd91 (diff)
partitions/efi: use lba-aware partition records
The kernel's GPT implementation currently uses the generic 'struct partition' type for dealing with legacy MBR partition records. While this is is useful for disklabels that we designed for CHS addressing, such as msdos, it doesn't adapt well to newer standards that use LBA instead, such as GUID partition tables. Furthermore, these generic partition structures do not have all the required fields to properly follow the UEFI specs. While a CHS address can be translated to LBA, it's much simpler and cleaner to just replace the partition type. This patch adds a new 'gpt_record' type that is fully compliant with EFI and will allow, in the next patches, to add more checks to properly verify a protective MBR, which is paramount to probing a device that makes use of GPT. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Davidlohr Bueso <davidlohr@hp.com> Reviewed-by: Karel Zak <kzak@redhat.com> Acked-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/partitions/efi.c')
-rw-r--r--block/partitions/efi.c9
1 files changed, 4 insertions, 5 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)
bdev_logical_block_size(bdev)) - 1ULL;
}
-static inline int
-pmbr_part_valid(struct partition *part)
+static inline int pmbr_part_valid(gpt_mbr_record *part)
{
- if (part->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT &&
- le32_to_cpu(part->start_sect) == 1UL)
- return 1;
+ if (part->os_type == EFI_PMBR_OSTYPE_EFI_GPT &&
+ le32_to_cpu(part->start_sector) == 1UL)
+ return 1;
return 0;
}