summaryrefslogtreecommitdiffstats
path: root/discover/event-parser.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-03-14 14:18:54 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-29 14:31:20 +1000
commite4f5bd235894c11823ac1befe8c8c43063cad026 (patch)
treec5787f3434f43d331edfb55dc64d1d4dfe1cb807 /discover/event-parser.c
parent397dc244bfdc2a57fc3e8fd191b0ef60c8a4b66b (diff)
downloadpetitboot-e4f5bd235894c11823ac1befe8c8c43063cad026.zip
petitboot-e4f5bd235894c11823ac1befe8c8c43063cad026.tar.gz
discover: Introduce a container type for boot options
This change introduces a new type, struct discover_boot_option. Like struct discover_device adds discover-specific data to struct device, struct discover_boot_option allows the discover server to store more than just the boot option strings for a boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/event-parser.c')
-rw-r--r--discover/event-parser.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/discover/event-parser.c b/discover/event-parser.c
index d7c0820..289fee9 100644
--- a/discover/event-parser.c
+++ b/discover/event-parser.c
@@ -16,15 +16,17 @@
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;
}
OpenPOWER on IntegriCloud