From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 07:19:40 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08C70106564A; Thu, 21 Jun 2012 07:19:40 +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 E878B8FC12; Thu, 21 Jun 2012 07:19:39 +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 q5L7JdVZ095834; Thu, 21 Jun 2012 07:19:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L7JdVV095832; Thu, 21 Jun 2012 07:19:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210719.q5L7JdVV095832@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 07:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237359 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 07:19:40 -0000 Author: ae Date: Thu Jun 21 07:19:39 2012 New Revision: 237359 URL: http://svn.freebsd.org/changeset/base/237359 Log: When we read partition tables we use bd_read, that directly reads from device bypassing bd_strategy. So we need add od_boff if we want read nested partition tables. Also, when we open MBR slice, try to detect nested partition table. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:16:12 2012 (r237358) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:19:39 2012 (r237359) @@ -375,8 +375,9 @@ bd_open(struct open_file *f, ...) static int diskread(void *dev, void *buf, size_t blocks, off_t offset) { + struct open_disk *od = dev; - return (bd_read(dev, offset, blocks, buf)); + return (bd_read(dev, offset + od->od_boff, blocks, buf)); } static int @@ -448,8 +449,7 @@ bd_opendisk(struct open_disk **odp, stru goto out; /* Adjust open_disk's offset within the biosdisk */ od->od_boff = part.start; - if (dev->d_kind.biosdisk.partition == -1 || - dev->d_kind.biosdisk.partition == 255) + if (dev->d_kind.biosdisk.partition == 255) goto out; /* Nothing more to do */ /* Try to read BSD label */ @@ -463,6 +463,8 @@ bd_opendisk(struct open_disk **odp, stru } /* Save the slice number of the parent partition */ od->od_slice = part.index; + if (dev->d_kind.biosdisk.partition == -1) + goto out; /* Nothing more to do */ error = ptable_getpart(od->od_ptable, &part, dev->d_kind.biosdisk.partition); if (error != 0) {