Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2012 05:17:25 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r234693 - stable/9/sys/boot/common
Message-ID:  <201204260517.q3Q5HPWH031269@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Apr 26 05:17:25 2012
New Revision: 234693
URL: http://svn.freebsd.org/changeset/base/234693

Log:
  MFC r234692:
    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.

Modified:
  stable/9/sys/boot/common/gpt.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/common/gpt.c
==============================================================================
--- stable/9/sys/boot/common/gpt.c	Thu Apr 26 02:03:16 2012	(r234692)
+++ stable/9/sys/boot/common/gpt.c	Thu Apr 26 05:17:25 2012	(r234693)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204260517.q3Q5HPWH031269>