summaryrefslogtreecommitdiffstats
path: root/discover/yaboot-parser.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-13 09:16:00 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-15 14:38:04 +0800
commit1b50985db4e85030de3567792aedc13aa26e0fea (patch)
tree48cca47b21140712ca20b5eaff2c4b041fb6ac48 /discover/yaboot-parser.c
parent07bf13167aacf49a694aea3341caa15379916bec (diff)
downloadtalos-petitboot-1b50985db4e85030de3567792aedc13aa26e0fea.tar.gz
talos-petitboot-1b50985db4e85030de3567792aedc13aa26e0fea.zip
discover: Always associate resources with a boot option
We should always be tallocing resources to a boot option context; anything else (for example, the discover context) may have a different lifetime. In order to enforce this, we change the void *ctx argument to the context_create functions to a struct discover_boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/yaboot-parser.c')
-rw-r--r--discover/yaboot-parser.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
index 9399cc7..3696abf 100644
--- a/discover/yaboot-parser.c
+++ b/discover/yaboot-parser.c
@@ -52,6 +52,7 @@ static void yaboot_finish(struct conf_context *conf)
}
static struct resource *create_yaboot_devpath_resource(
+ struct discover_boot_option *opt,
struct conf_context *conf,
const char *path, char **desc_str)
{
@@ -69,7 +70,7 @@ static struct resource *create_yaboot_devpath_resource(
devpath = talloc_strdup(conf, path);
}
- res = create_devpath_resource(conf->dc, conf->dc->device, devpath);
+ res = create_devpath_resource(opt, conf->dc->device, devpath);
if (desc_str)
*desc_str = devpath;
@@ -124,8 +125,8 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
opt->option->boot_args = talloc_strdup(opt->option, "");
/* Then start the new image. */
- opt->boot_image = create_yaboot_devpath_resource(conf,
- value, &state->desc_image);
+ opt->boot_image = create_yaboot_devpath_resource(opt,
+ conf, value, &state->desc_image);
state->opt = opt;
@@ -154,16 +155,16 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
state->opt = opt;
if (*value == '/') {
- opt->boot_image = create_yaboot_devpath_resource(
+ opt->boot_image = create_yaboot_devpath_resource(opt,
conf, value, &state->desc_image);
} else {
char *tmp;
- opt->boot_image = create_yaboot_devpath_resource(
+ opt->boot_image = create_yaboot_devpath_resource(opt,
conf, suse_fp->image,
&state->desc_image);
- opt->initrd = create_yaboot_devpath_resource(
+ opt->initrd = create_yaboot_devpath_resource(opt,
conf, suse_fp->initrd, &tmp);
state->desc_initrd = talloc_asprintf(opt,
@@ -182,7 +183,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
/* initrd */
if (streq(name, "initrd")) {
- opt->initrd = create_yaboot_devpath_resource(conf,
+ opt->initrd = create_yaboot_devpath_resource(opt, conf,
value, &state->desc_image);
return;
OpenPOWER on IntegriCloud