]> git.ozlabs.org Git - petitboot/commitdiff
discover/grub2: Allow URL resources
authorJeremy Kerr <jk@ozlabs.org>
Mon, 14 Oct 2013 07:21:14 +0000 (15:21 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 14 Oct 2013 07:24:03 +0000 (15:24 +0800)
Allow URL-format specifiers for GRUB2 resources.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/grub2.c
discover/grub2/grub2.h

index fb3d8668a99bdfa5334ff8f62e6b4e98904e4af3..22d42dfc432a093d776a03b4109847413a66077b 100644 (file)
@@ -2,6 +2,7 @@
 #include <assert.h>
 
 #include <talloc/talloc.h>
 #include <assert.h>
 
 #include <talloc/talloc.h>
+#include <url/url.h>
 
 #include <discover/resource.h>
 #include <discover/parser.h>
 
 #include <discover/resource.h>
 #include <discover/parser.h>
@@ -36,14 +37,20 @@ struct grub2_resource_info {
 };
 
 /* we use slightly different resources for grub2 */
 };
 
 /* we use slightly different resources for grub2 */
-struct resource *create_grub2_resource(void *ctx,
+struct resource *create_grub2_resource(struct discover_boot_option *opt,
                struct discover_device *orig_device,
                const char *root, const char *path)
 {
        struct grub2_resource_info *info;
        struct resource *res;
 
                struct discover_device *orig_device,
                const char *root, const char *path)
 {
        struct grub2_resource_info *info;
        struct resource *res;
 
-       res = talloc(ctx, struct resource);
+       if (strstr(path, "://")) {
+               struct pb_url *url = pb_url_parse(opt, path);
+               if (url)
+                       return create_url_resource(opt, url);
+       }
+
+       res = talloc(opt, struct resource);
 
        if (root) {
                info = talloc(res, struct grub2_resource_info);
 
        if (root) {
                info = talloc(res, struct grub2_resource_info);
index 5ee8503dbf88af6c0db0934c075faac3cf3c24db..1515d690a528ed1931ec1d07692748da09b8bb38 100644 (file)
@@ -167,7 +167,7 @@ void script_register_function(struct grub2_script *script,
 void register_builtins(struct grub2_script *script);
 
 /* resources */
 void register_builtins(struct grub2_script *script);
 
 /* resources */
-struct resource *create_grub2_resource(void *ctx,
+struct resource *create_grub2_resource(struct discover_boot_option *opt,
                struct discover_device *orig_device,
                const char *root, const char *path);
 
                struct discover_device *orig_device,
                const char *root, const char *path);