X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fresource.c;h=25fff650db7fabc6bfe805525c38c379a3ce7708;hp=b31a215b39be8b345e46abe97fcb1c2ae16387de;hb=fb0fdcc59d7b0f2ed97f1894b25e4424131970f6;hpb=1b50985db4e85030de3567792aedc13aa26e0fea diff --git a/discover/resource.c b/discover/resource.c index b31a215..25fff65 100644 --- a/discover/resource.c +++ b/discover/resource.c @@ -6,6 +6,7 @@ #include #include +#include #include #include "device-handler.h" @@ -33,7 +34,8 @@ static struct discover_device *parse_device_string( return device_lookup_by_name(handler, devstr); } -static void resolve_devpath_against_device(struct resource *res, + +void resolve_resource_against_device(struct resource *res, struct discover_device *dev, const char *path) { char *resolved_path = join_paths(res, dev->mount_path, path); @@ -66,7 +68,7 @@ struct resource *create_devpath_resource(struct discover_boot_option *opt, /* we've been passed a file:// URL, which has no device * specifier. We can resolve against the original * device */ - resolve_devpath_against_device(res, orig_device, + resolve_resource_against_device(res, orig_device, url->path); talloc_free(url); } @@ -75,13 +77,15 @@ struct resource *create_devpath_resource(struct discover_boot_option *opt, /* if there was no device specified, we can resolve now */ if (!pos) { - resolve_devpath_against_device(res, orig_device, devpath); + resolve_resource_against_device(res, orig_device, devpath); return res; } devstr = talloc_strndup(res, devpath, pos - devpath); path = talloc_strdup(res, pos + 1); + pb_log("%s: resource depends on device %s\n", __func__, devstr); + /* defer resolution until we can find a suitable matching device */ info = talloc(res, struct devpath_resource_info); info->dev = devstr; @@ -106,7 +110,7 @@ bool resolve_devpath_resource(struct device_handler *handler, if (!dev) return false; - resolve_devpath_against_device(res, dev, info->path); + resolve_resource_against_device(res, dev, info->path); talloc_free(info); return true;