]> git.ozlabs.org Git - petitboot/blobdiff - discover/event-parser.c
discover: Separate temporary and permanent device data
[petitboot] / discover / event-parser.c
index 0b96a09ba72365b774b406d94d30feb60f247530..d7c0820083ff8a098383992939d357b2377e6cfc 100644 (file)
@@ -6,6 +6,7 @@
 #include "talloc/talloc.h"
 #include "event.h"
 #include "parser-utils.h"
+#include "device-handler.h"
 
 /**
  * parse_user_event - Parse a user event.
  * Understands params: name, image, args.
  */
 
-int parse_user_event(struct device *device, struct event *event)
+int parse_user_event(struct discover_context *ctx, struct event *event)
 {
        struct boot_option *opt;
+       struct device *dev;
        const char *p;
 
-       opt = talloc_zero(device, struct boot_option);
+       dev = ctx->device->device;
+
+       opt = talloc_zero(dev, struct boot_option);
 
        if (!opt)
                goto fail;
@@ -30,7 +34,8 @@ int parse_user_event(struct device *device, struct event *event)
                goto fail;
        }
 
-       opt->id = talloc_asprintf(opt, "%s#%s", device->id, p);
+       opt->id = talloc_asprintf(opt, "%s#%s", dev->id, p);
+       opt->device_id = talloc_strdup(opt, dev->id);
        opt->name = talloc_strdup(opt, p);
 
        p = event_get_param(event, "image");
@@ -51,7 +56,7 @@ int parse_user_event(struct device *device, struct event *event)
        opt->description = talloc_asprintf(opt, "%s %s", opt->boot_image_file,
                opt->boot_args);
 
-       device_add_boot_option(device, opt);
+       discover_context_add_boot_option(ctx, opt);
 
        return 0;