]> git.ozlabs.org Git - petitboot/blobdiff - discover/resource.c
discover/discover-server: explicit #include <string.h>
[petitboot] / discover / resource.c
index b4fa9ca3930f350b8622027a793c0a5be427ef55..04e14cb42c634567a5d99f3cbab226d5055139d0 100644 (file)
@@ -1,5 +1,7 @@
 
-#define _GNU_SOURCE
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
 
 #include <assert.h>
 #include <stdbool.h>
@@ -34,7 +36,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);
@@ -67,7 +70,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);
                }
@@ -76,7 +79,7 @@ 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;
        }
 
@@ -109,7 +112,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;
@@ -121,6 +124,7 @@ struct resource *create_url_resource(struct discover_boot_option *opt,
        struct resource *res;
 
        res = talloc(opt, struct resource);
+       talloc_steal(res, url);
        res->url = url;
        res->resolved = true;