From owner-svn-src-all@FreeBSD.ORG Mon Aug 13 13:08:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4552F1065676; Mon, 13 Aug 2012 13:08:31 +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 1619B8FC16; Mon, 13 Aug 2012 13:08:31 +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 q7DD8UND042089; Mon, 13 Aug 2012 13:08:30 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7DD8UPu042086; Mon, 13 Aug 2012 13:08:30 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208131308.q7DD8UPu042086@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 13 Aug 2012 13:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239230 - head/sys/boot/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2012 13:08:31 -0000 Author: ae Date: Mon Aug 13 13:08:30 2012 New Revision: 239230 URL: http://svn.freebsd.org/changeset/base/239230 Log: Unbreak booting from the true dedicated disks. When we open the disk, check the type of partition table, that has been detected. If this is BSD label, then we assume this is DD mode. Reported by: dim@ Modified: head/sys/boot/common/disk.c head/sys/boot/common/disk.h Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Mon Aug 13 08:16:30 2012 (r239229) +++ head/sys/boot/common/disk.c Mon Aug 13 13:08:30 2012 (r239230) @@ -173,7 +173,13 @@ disk_open(struct disk_devdesc *dev, off_ rc = ENXIO; goto out; } - if (dev->d_slice > 0) { + if (ptable_gettype(od->table) == PTABLE_BSD && + dev->d_partition >= 0) { + /* It doesn't matter what value has d_slice */ + rc = ptable_getpart(od->table, &part, dev->d_partition); + if (rc == 0) + dev->d_offset = part.start; + } else if (dev->d_slice > 0) { /* Try to get information about partition */ rc = ptable_getpart(od->table, &part, dev->d_slice); if (rc != 0) /* Partition doesn't exist */ @@ -247,9 +253,9 @@ disk_fmtdev(struct disk_devdesc *dev) #ifdef LOADER_MBR_SUPPORT cp += sprintf(cp, "s%d", dev->d_slice); #endif - if (dev->d_partition >= 0) - cp += sprintf(cp, "%c", dev->d_partition + 'a'); } + if (dev->d_partition >= 0) + cp += sprintf(cp, "%c", dev->d_partition + 'a'); strcat(cp, ":"); return (buf); } Modified: head/sys/boot/common/disk.h ============================================================================== --- head/sys/boot/common/disk.h Mon Aug 13 08:16:30 2012 (r239229) +++ head/sys/boot/common/disk.h Mon Aug 13 13:08:30 2012 (r239230) @@ -45,6 +45,11 @@ * d_slice = MBR slice number (typically 1..4) * d_partition = disklabel partition (typically 0..7) * + * BSD disklabel partition on the true dedicated disk: + * + * d_slice = -1 + * d_partition = disklabel partition (typically 0..7) + * * GPT partition: * * d_slice = GPT partition number (typically 1..N)