]> git.ozlabs.org Git - petitboot/blobdiff - discover/event-parser.c
discover: Consolidate user events by device ID
[petitboot] / discover / event-parser.c
index 0b96a09ba72365b774b406d94d30feb60f247530..c09c5babc27a1e44d642c31f523688b55b652ff4 100644 (file)
@@ -13,7 +13,7 @@
  * Understands params: name, image, args.
  */
 
-int parse_user_event(struct device *device, struct event *event)
+struct boot_option *parse_user_event(struct device *device, struct event *event)
 {
        struct boot_option *opt;
        const char *p;
@@ -31,6 +31,7 @@ int parse_user_event(struct device *device, struct event *event)
        }
 
        opt->id = talloc_asprintf(opt, "%s#%s", device->id, p);
+       opt->device_id = talloc_strdup(opt, device->id);
        opt->name = talloc_strdup(opt, p);
 
        p = event_get_param(event, "image");
@@ -53,9 +54,9 @@ int parse_user_event(struct device *device, struct event *event)
 
        device_add_boot_option(device, opt);
 
-       return 0;
+       return opt;
 
 fail:
        talloc_free(opt);
-       return -1;
+       return NULL;
 }