]> git.ozlabs.org Git - petitboot/blobdiff - discover/event-parser.c
discover: Introduce a container type for boot options
[petitboot] / discover / event-parser.c
index d7c0820083ff8a098383992939d357b2377e6cfc..289fee96bdf8da7f688b985ad66b7216985dcbd6 100644 (file)
 
 int parse_user_event(struct discover_context *ctx, struct event *event)
 {
+       struct discover_boot_option *d_opt;
        struct boot_option *opt;
        struct device *dev;
        const char *p;
 
        dev = ctx->device->device;
 
-       opt = talloc_zero(dev, struct boot_option);
+       d_opt = discover_boot_option_create(ctx, ctx->device);
+       opt = d_opt->option;
 
-       if (!opt)
+       if (!d_opt)
                goto fail;
 
        p = event_get_param(event, "name");
@@ -56,11 +58,11 @@ int parse_user_event(struct discover_context *ctx, struct event *event)
        opt->description = talloc_asprintf(opt, "%s %s", opt->boot_image_file,
                opt->boot_args);
 
-       discover_context_add_boot_option(ctx, opt);
+       discover_context_add_boot_option(ctx, d_opt);
 
        return 0;
 
 fail:
-       talloc_free(opt);
+       talloc_free(d_opt);
        return -1;
 }