X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fyaboot-parser.c;h=22792d4a63b4007bcfc46c400ab88cf8b2adbbc4;hp=c0750fe1f227e08f4e17ccac674c7b4b2e8a89d9;hb=503d1454f222e2b0c6f8dd433a9e91870a17f460;hpb=50a98e73d4eed46e859368915a7800cc904b44f2 diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c index c0750fe..22792d4 100644 --- a/discover/yaboot-parser.c +++ b/discover/yaboot-parser.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "log/log.h" #include "talloc/talloc.h" @@ -53,9 +54,9 @@ static struct resource *create_yaboot_devpath_resource( const char *path) { struct discover_boot_option *opt = state->opt; - const char *dev, *part; + const char *dev, *part, *devpos; struct resource *res; - char *devpath; + char *devpath, *devstr; dev = state->device; part = state->partition; @@ -69,8 +70,19 @@ static struct resource *create_yaboot_devpath_resource( devpath = talloc_strdup(conf, path); } else if (dev && part) { - devpath = talloc_asprintf(conf, - "%s%s:%s", dev, part, path); + devpos = &dev[strlen(dev) - 1]; + if (isdigit(*devpos)) { + while (isdigit(*devpos)) + devpos--; + + devstr = talloc_strndup(conf, dev, devpos - dev + 1); + devpath = talloc_asprintf(conf, "%s%s:%s", devstr, + part, path); + talloc_free(devstr); + } else { + devpath = talloc_asprintf(conf, + "%s%s:%s", dev, part, path); + } } else if (dev) { devpath = talloc_asprintf(conf, "%s:%s", dev, path); } else {