From owner-svn-src-stable@FreeBSD.ORG Thu Apr 26 05:17:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4673D106564A; Thu, 26 Apr 2012 05:17:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3149F8FC14; Thu, 26 Apr 2012 05:17:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3Q5HQvm031271; Thu, 26 Apr 2012 05:17:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3Q5HPWH031269; Thu, 26 Apr 2012 05:17:25 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201204260517.q3Q5HPWH031269@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Apr 2012 05:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234693 - stable/9/sys/boot/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Apr 2012 05:17:26 -0000 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);