svn commit: r241121 - in projects/bhyve/sys/boot: common
userboot/userboot
Peter Grehan
grehan at FreeBSD.org
Tue Oct 2 04:41:44 UTC 2012
Author: grehan
Date: Tue Oct 2 04:41:43 2012
New Revision: 241121
URL: http://svn.freebsd.org/changeset/base/241121
Log:
Fix the error return in disk_readslicetab() when an MBR/GPT partition
wasn't found, and use that in userdisk_open() to allow raw disks
and ISO images to be read.
This is a temporary fix - disk.c has changed a lot in CURRENT so this
code may be reworked or made redundant on the next IFC. It is useful
to be able to boot from CD in the meantime.
Modified:
projects/bhyve/sys/boot/common/disk.c
projects/bhyve/sys/boot/userboot/userboot/userboot_disk.c
Modified: projects/bhyve/sys/boot/common/disk.c
==============================================================================
--- projects/bhyve/sys/boot/common/disk.c Tue Oct 2 04:36:37 2012 (r241120)
+++ projects/bhyve/sys/boot/common/disk.c Tue Oct 2 04:41:43 2012 (r241121)
@@ -192,6 +192,7 @@ disk_readslicetab(struct disk_devdesc *d
*/
if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
DEBUG("no slice table/MBR (no magic)");
+ rc = EEXIST;
return (rc);
}
Modified: projects/bhyve/sys/boot/userboot/userboot/userboot_disk.c
==============================================================================
--- projects/bhyve/sys/boot/userboot/userboot/userboot_disk.c Tue Oct 2 04:36:37 2012 (r241120)
+++ projects/bhyve/sys/boot/userboot/userboot/userboot_disk.c Tue Oct 2 04:41:43 2012 (r241121)
@@ -103,6 +103,7 @@ userdisk_open(struct open_file *f, ...)
{
va_list ap;
struct disk_devdesc *dev;
+ int rc;
va_start(ap, f);
dev = va_arg(ap, struct disk_devdesc *);
@@ -111,7 +112,15 @@ userdisk_open(struct open_file *f, ...)
if (dev->d_unit < 0 || dev->d_unit >= userboot_disk_maxunit)
return (EIO);
- return (disk_open(dev));
+ rc = disk_open(dev);
+
+ /*
+ * No MBR/GPT - assume a raw disk image
+ */
+ if (rc)
+ dev->d_offset = 0;
+
+ return (0);
}
static int
More information about the svn-src-projects
mailing list