diff --git a/stand/common/disk.c b/stand/common/disk.c --- a/stand/common/disk.c +++ b/stand/common/disk.c @@ -420,7 +420,7 @@ char *cp; struct disk_devdesc *dev; - np = devspec; + np = devspec + 4; /* Skip the leading 'disk' */ unit = -1; /* * If there is path/file info after the device info, then any missing diff --git a/stand/i386/zfsboot/zfsboot.c b/stand/i386/zfsboot/zfsboot.c --- a/stand/i386/zfsboot/zfsboot.c +++ b/stand/i386/zfsboot/zfsboot.c @@ -214,7 +214,7 @@ devinit(); /* XXX assumes this will be a disk, but it looks likely give above */ - disk_parsedev((struct devdesc **)&devdesc, boot_devname + 4, NULL); + disk_parsedev((struct devdesc **)&devdesc, boot_devname, NULL); bootdev = MAKEBOOTDEV(dev_maj[DEVT_DISK], devdesc->d_slice + 1, devdesc->dd.d_unit, diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c --- a/stand/libofw/devicename.c +++ b/stand/libofw/devicename.c @@ -112,7 +112,7 @@ if (dv->dv_parsedev != NULL) { p = devspec + strlen(dv->dv_name); free(idev); - err = dv->dv_parsedev((struct devdesc **)&idev, p, path); + err = dv->dv_parsedev((struct devdesc **)&idev, devspec, path); if (err != 0) { return (err); } diff --git a/stand/libsa/dev.c b/stand/libsa/dev.c --- a/stand/libsa/dev.c +++ b/stand/libsa/dev.c @@ -134,7 +134,7 @@ idev = NULL; err = 0; if (dv->dv_parsedev) { - err = dv->dv_parsedev(&idev, np, path); + err = dv->dv_parsedev(&idev, devspec, path); } else { np = devspec + strlen(dv->dv_name); err = default_parsedev(&idev, np, path); diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -385,7 +385,7 @@ int rv; errno = 0; - rv = zfs_parsedev((struct devdesc **)&zfsdev, dev + 3, NULL); + rv = zfs_parsedev((struct devdesc **)&zfsdev, dev, NULL); if (rv != 0) { return (rv); } @@ -1644,7 +1644,7 @@ int rv; struct zfs_devdesc *dev; - np = devspec; + np = devspec + 3; /* Skip the leading 'zfs' */ if (*np != ':') return (EINVAL); np++; diff --git a/stand/uboot/devicename.c b/stand/uboot/devicename.c --- a/stand/uboot/devicename.c +++ b/stand/uboot/devicename.c @@ -116,7 +116,7 @@ #ifdef LOADER_DISK_SUPPORT case DEVT_DISK: free(idev); - err = disk_parsedev((struct devdesc **)&idev, np, path); + err = disk_parsedev((struct devdesc **)&idev, devspec, path); if (err != 0) goto fail; break; diff --git a/stand/uboot/main.c b/stand/uboot/main.c --- a/stand/uboot/main.c +++ b/stand/uboot/main.c @@ -233,11 +233,17 @@ * parse the remainder of the string as such, and if it works, return * those results. Otherwise we'll fall through to the code that parses * the legacy format. + * + * disk_parsedev now assumes that it points to the start of the device + * name, but since it doesn't know about uboot's usage, just subtract 4 + * since it always adds 4. This is the least-bad solution since it makes + * all the other loader code easier (might be better to create a fake + * 'disk...' string, but that's more work than uboot is worth). */ if (*type & DEV_TYP_STOR) { size_t len = strlen(p); if (strcspn(p, " .") == len && strcspn(p, ":") >= len - 1 && - disk_parsedev((struct devdesc **)&dev, p, NULL) == 0) { + disk_parsedev((struct devdesc **)&dev, p - 4, NULL) == 0) { /* Hack */ *unit = dev->dd.d_unit; *slice = dev->d_slice; *partition = dev->d_partition;