summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2012-04-12 12:37:53 +0000
committerae <ae@FreeBSD.org>2012-04-12 12:37:53 +0000
commitaac5c3d394ed93a4f5db4078eaf4d4303a500dbf (patch)
tree5e6d0cabe99748a34923b229906af7d2744d17c1 /sys/boot/common
parent3d2bebcc357d4da177ad59f682b1fc1ed4bd0cc0 (diff)
downloadFreeBSD-src-aac5c3d394ed93a4f5db4078eaf4d4303a500dbf.zip
FreeBSD-src-aac5c3d394ed93a4f5db4078eaf4d4303a500dbf.tar.gz
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
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/gpt.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/boot/common/gpt.c b/sys/boot/common/gpt.c
index 0078abc..8baa64c 100644
--- a/sys/boot/common/gpt.c
+++ b/sys/boot/common/gpt.c
@@ -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);
OpenPOWER on IntegriCloud