summaryrefslogtreecommitdiffstats
path: root/discover/yaboot-parser.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-03-11 17:08:57 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-16 12:57:15 +0800
commit92806cf6bc15f680f75879288df12ea9a87e4608 (patch)
tree4a6650d8881dda3c6ee321d1e3350edc646c4baf /discover/yaboot-parser.c
parent7b396a45d43cc464539cc25799ddda3a27339bd8 (diff)
downloadtalos-petitboot-92806cf6bc15f680f75879288df12ea9a87e4608.tar.gz
talos-petitboot-92806cf6bc15f680f75879288df12ea9a87e4608.zip
discover: Separate temporary and permanent device data
At present, we keep both permanent (eg links/n_links) and temporary (event) data in struct discover_context. This change makes discover_context a temporary structure, just used during actual device discovery. Once discovery is complete, the permanent data (discover_device) is "committed" to the device handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/yaboot-parser.c')
-rw-r--r--discover/yaboot-parser.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
index 59e52b8..b287817 100644
--- a/discover/yaboot-parser.c
+++ b/discover/yaboot-parser.c
@@ -22,10 +22,10 @@ struct yaboot_state {
static void yaboot_finish(struct conf_context *conf)
{
struct yaboot_state *state = conf->parser_info;
+ struct device *dev = conf->dc->device->device;
if (!state->desc_image) {
- pb_log("%s: %s: no image found\n", __func__,
- conf->dc->device->id);
+ pb_log("%s: %s: no image found\n", __func__, dev->id);
return;
}
@@ -46,8 +46,9 @@ static void yaboot_finish(struct conf_context *conf)
/* opt is persistent, so must be associated with device */
- device_add_boot_option(conf->dc->device, state->opt);
- state->opt = talloc_zero(conf->dc->device, struct boot_option);
+ discover_context_add_boot_option(conf->dc, state->opt);
+
+ state->opt = talloc_zero(conf->dc, struct boot_option);
state->opt->boot_args = talloc_strdup(state->opt, "");
}
@@ -111,7 +112,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
"%s%s", g_boot, value);
} else {
state->opt->boot_image_file = resolve_path(state->opt,
- value, conf->dc->device_path);
+ value, conf->dc->device->device_path);
state->desc_image = talloc_strdup(state->opt, value);
}
@@ -137,16 +138,16 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
if (*value == '/') {
state->opt->boot_image_file = resolve_path(state->opt,
- value, conf->dc->device_path);
+ value, conf->dc->device->device_path);
state->desc_image = talloc_strdup(state->opt, value);
} else {
state->opt->boot_image_file = resolve_path(state->opt,
- suse_fp->image, conf->dc->device_path);
+ suse_fp->image, conf->dc->device->device_path);
state->desc_image = talloc_strdup(state->opt,
suse_fp->image);
state->opt->initrd_file = resolve_path(state->opt,
- suse_fp->initrd, conf->dc->device_path);
+ suse_fp->initrd, conf->dc->device->device_path);
state->desc_initrd = talloc_asprintf(state, "initrd=%s",
suse_fp->initrd);
}
@@ -181,7 +182,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
"initrd=%s%s", g_boot, value);
} else {
state->opt->initrd_file = resolve_path(state->opt,
- value, conf->dc->device_path);
+ value, conf->dc->device->device_path);
state->desc_initrd = talloc_asprintf(state, "initrd=%s",
value);
}
@@ -192,7 +193,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
if (streq(name, "label")) {
state->opt->id = talloc_asprintf(state->opt, "%s#%s",
- conf->dc->device->id, value);
+ conf->dc->device->device->id, value);
state->opt->name = talloc_strdup(state->opt, value);
return;
}
OpenPOWER on IntegriCloud