X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fgrub2-parser.c;h=05893292ea2b4cf93caa30f0a2d34e4bcb9bc605;hb=c8be6d76e4d8e4aa39dd89ddf5a33287ca8f7350;hp=8a0868a7a72bdba905cf0d379c1c0e08ac3c65b7;hpb=e4f5bd235894c11823ac1befe8c8c43063cad026;p=petitboot diff --git a/discover/grub2-parser.c b/discover/grub2-parser.c index 8a0868a..0589329 100644 --- a/discover/grub2-parser.c +++ b/discover/grub2-parser.c @@ -30,7 +30,7 @@ #include "types/types.h" #include "parser-conf.h" #include "parser-utils.h" -#include "paths.h" +#include "resource.h" struct grub2_state { struct discover_boot_option *opt; @@ -85,7 +85,7 @@ static void grub2_process_pair(struct conf_context *conf, const char *name, { struct device *dev = conf->dc->device->device; struct grub2_state *state = conf->parser_info; - struct boot_option *opt = state->opt->option; + struct discover_boot_option *opt = state->opt; if (!name || !conf_param_in_list(state->known_names, name)) return; @@ -102,8 +102,9 @@ static void grub2_process_pair(struct conf_context *conf, const char *name, if (sep) *sep = 0; - opt->id = talloc_asprintf(opt, "%s#%s", dev->id, value); - opt->name = talloc_strdup(opt, value); + opt->option->id = talloc_asprintf(opt->option, + "%s#%s", dev->id, value); + opt->option->name = talloc_strdup(opt->option, value); return; } @@ -116,20 +117,19 @@ static void grub2_process_pair(struct conf_context *conf, const char *name, if (sep) *sep = 0; - opt->boot_image_file = resolve_path(opt, value, - conf->dc->device->device_path); + opt->boot_image = create_devpath_resource(opt, + conf->dc->device, value); state->desc_image = talloc_strdup(opt, value); if (sep) - opt->boot_args = talloc_strdup(opt, - sep + 1); + opt->option->boot_args = talloc_strdup(opt, sep + 1); return; } if (streq(name, "initrd")) { - opt->initrd_file = resolve_path(opt, - value, conf->dc->device->device_path); + opt->initrd = create_devpath_resource(opt, + conf->dc->device, value); state->desc_initrd = talloc_asprintf(state, "initrd=%s", value); return; @@ -191,8 +191,11 @@ static int grub2_parse(struct discover_context *dc, char *buf, int len) return 1; } -struct parser __grub2_parser = { +static struct parser grub2_parser = { .name = "grub2", + .method = CONF_METHOD_LOCAL_FILE, .parse = grub2_parse, .filenames = grub2_conf_files, }; + +register_parser(grub2_parser);