1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-04 17:15:50 +00:00

Read backup GPT header from the last LBA only when primary GPT header and

table aren't valid. If they are ok, use hdr_lba_alt value to read backup
header. This will make gptboot happy when GPT used atop of some GEOM
provider, e.g. GEOM_MIRROR.

Reviewed by:	pjd
MFC after:	2 weeks
This commit is contained in:
Andrey V. Elsukov 2012-04-12 12:37:53 +00:00
parent 3c0caf6ce6
commit 9dd5659756
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234176

View File

@ -337,16 +337,16 @@ gptread(const uuid_t *uuid, struct dsk *dskp, char *buf)
gpttable = table_primary;
}
altlba = drvsize(dskp);
if (altlba > 0)
altlba--;
else if (hdr_primary_lba > 0) {
if (hdr_primary_lba > 0) {
/*
* If we cannot obtain disk size, but primary header
* is valid, we can get backup header location from
* there.
* If primary header is valid, we can get backup
* header location from there.
*/
altlba = hdr_primary.hdr_lba_alt;
} else {
altlba = drvsize(dskp);
if (altlba > 0)
altlba--;
}
if (altlba == 0)
printf("%s: unable to locate backup GPT header\n", BOOTPROG);