From d2a32f50660d32885ee20b6e3b5bbabfecd2b4e9 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 14 Oct 2013 15:21:14 +0800 Subject: discover/grub2: Allow URL resources Allow URL-format specifiers for GRUB2 resources. Signed-off-by: Jeremy Kerr --- discover/grub2/grub2.c | 11 +++++++++-- discover/grub2/grub2.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/discover/grub2/grub2.c b/discover/grub2/grub2.c index fb3d866..22d42df 100644 --- a/discover/grub2/grub2.c +++ b/discover/grub2/grub2.c @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -36,14 +37,20 @@ struct grub2_resource_info { }; /* 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; - 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); diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h index 5ee8503..1515d69 100644 --- a/discover/grub2/grub2.h +++ b/discover/grub2/grub2.h @@ -167,7 +167,7 @@ void script_register_function(struct grub2_script *script, 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); -- cgit v1.2.1