#include <assert.h>
#include <talloc/talloc.h>
+#include <url/url.h>
#include <discover/resource.h>
#include <discover/parser.h>
};
struct grub2_resource_info {
- struct grub2_root *root;
+ char *root;
char *path;
};
/* 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,
- struct grub2_root *root, const char *path)
+ 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);
- info->root = root;
talloc_reference(info, root);
+ info->root = talloc_strdup(info, root);
info->path = talloc_strdup(info, path);
res->resolved = false;
assert(!res->resolved);
- dev = device_lookup_by_uuid(handler, info->root->uuid);
+ dev = device_lookup_by_uuid(handler, info->root);
if (!dev)
return false;