mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
partitions/efi: Support non-standard GPT location
Support looking up GPT at a non-standard location specified by a block device driver. Acked-by: Davidlohr Bueso <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
1 parent
0bdfbca8a6
commit
466d9c4904
1 file changed
+12
@@ -585,6 +585,8 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
gpt_header *pgpt = NULL, *agpt = NULL;
|
||||
gpt_entry *pptes = NULL, *aptes = NULL;
|
||||
legacy_mbr *legacymbr;
|
||||
struct gendisk *disk = state->disk;
|
||||
const struct block_device_operations *fops = disk->fops;
|
||||
sector_t total_sectors = get_capacity(state->disk);
|
||||
u64 lastlba;
|
||||
|
||||
@@ -619,6 +621,16 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
||||
if (!good_agpt && force_gpt)
|
||||
good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes);
|
||||
|
||||
if (!good_agpt && force_gpt && fops->alternative_gpt_sector) {
|
||||
sector_t agpt_sector;
|
||||
int err;
|
||||
|
||||
err = fops->alternative_gpt_sector(disk, &agpt_sector);
|
||||
if (!err)
|
||||
good_agpt = is_gpt_valid(state, agpt_sector,
|
||||
&agpt, &aptes);
|
||||
}
|
||||
|
||||
/* The obviously unsuccessful case */
|
||||
if (!good_pgpt && !good_agpt)
|
||||
goto fail;
|
||||
|
||||
Reference in new issue
Block a user