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 discover_boot_option *d_opt;
20 struct boot_option *opt;
24 dev = ctx->device->device;
26 d_opt = discover_boot_option_create(ctx, ctx->device);
32 p = event_get_param(event, "name");
35 pb_log("%s: no name found\n", __func__);
39 opt->id = talloc_asprintf(opt, "%s#%s", dev->id, p);
40 opt->device_id = talloc_strdup(opt, dev->id);
41 opt->name = talloc_strdup(opt, p);
43 p = event_get_param(event, "image");
47 pb_log("%s: no image found\n", __func__);
51 opt->boot_image_file = talloc_strdup(opt, p);
53 p = event_get_param(event, "args");
56 opt->boot_args = talloc_strdup(opt, p);
58 opt->description = talloc_asprintf(opt, "%s %s", opt->boot_image_file,
61 discover_context_add_boot_option(ctx, d_opt);