6 #include "talloc/talloc.h"
8 #include "parser-utils.h"
9 #include "device-handler.h"
12 * parse_user_event - Parse a user event.
14 * Understands params: name, image, args.
17 int parse_user_event(struct discover_context *ctx, struct event *event)
19 struct boot_option *opt;
23 dev = ctx->device->device;
25 opt = talloc_zero(dev, struct boot_option);
30 p = event_get_param(event, "name");
33 pb_log("%s: no name found\n", __func__);
37 opt->id = talloc_asprintf(opt, "%s#%s", dev->id, p);
38 opt->device_id = talloc_strdup(opt, dev->id);
39 opt->name = talloc_strdup(opt, p);
41 p = event_get_param(event, "image");
45 pb_log("%s: no image found\n", __func__);
49 opt->boot_image_file = talloc_strdup(opt, p);
51 p = event_get_param(event, "args");
54 opt->boot_args = talloc_strdup(opt, p);
56 opt->description = talloc_asprintf(opt, "%s %s", opt->boot_image_file,
59 discover_context_add_boot_option(ctx, opt);