svn commit: r234176 - head/sys/boot/common
Andrey V. Elsukov
ae at FreeBSD.org
Thu Apr 12 12:37:54 UTC 2012
Author: ae
Date: Thu Apr 12 12:37:53 2012
New Revision: 234176
URL: http://svn.freebsd.org/changeset/base/234176
Log:
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
Modified:
head/sys/boot/common/gpt.c
Modified: head/sys/boot/common/gpt.c
==============================================================================
--- head/sys/boot/common/gpt.c Thu Apr 12 12:15:15 2012 (r234175)
+++ head/sys/boot/common/gpt.c Thu Apr 12 12:37:53 2012 (r234176)
@@ -337,16 +337,16 @@ gptread(const uuid_t *uuid, struct dsk *
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);
More information about the svn-src-all
mailing list