Date: Thu, 21 Jun 2012 07:19:39 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r237359 - user/ae/bootcode/sys/boot/i386/libi386 Message-ID: <201206210719.q5L7JdVV095832@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206210719.q5L7JdVV095832>