Date: Thu, 12 Apr 2012 12:37:53 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234176 - head/sys/boot/common Message-ID: <201204121237.q3CCbrQu028522@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204121237.q3CCbrQu028522>