diff options
Diffstat (limited to 'stand/uboot/main.c')
-rw-r--r-- | stand/uboot/main.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/stand/uboot/main.c b/stand/uboot/main.c index 6648dc607c11..5a896959122e 100644 --- a/stand/uboot/main.c +++ b/stand/uboot/main.c @@ -26,8 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <stand.h> @@ -206,7 +204,7 @@ device_typename(int type) static void get_load_device(int *type, int *unit, int *slice, int *partition) { - struct disk_devdesc dev; + struct disk_devdesc *dev; char *devstr; const char *p; char *endp; @@ -233,14 +231,21 @@ get_load_device(int *type, int *unit, int *slice, int *partition) * 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(&dev, p, NULL) == 0) { - *unit = dev.dd.d_unit; - *slice = dev.d_slice; - *partition = dev.d_partition; + disk_parsedev((struct devdesc **)&dev, p - 4, NULL) == 0) { /* Hack */ + *unit = dev->dd.d_unit; + *slice = dev->d_slice; + *partition = dev->d_partition; + free(dev); return; } } @@ -334,7 +339,7 @@ get_load_device(int *type, int *unit, int *slice, int *partition) } static void -print_disk_probe_info() +print_disk_probe_info(void) { char slice[32]; char partition[32]; @@ -533,7 +538,7 @@ main(int argc, char **argv) return (0xbadef1ce); } - ldev = uboot_fmtdev(&currdev); + ldev = devformat(&currdev.dd); env_setenv("currdev", EV_VOLATILE, ldev, uboot_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset); printf("Booting from %s\n", ldev); |