- char *filepath;
- char *conf_file;
- char *tmpstr;
- ssize_t conf_len;
- int fd;
- struct stat st;
- char *label;
-
- devpath = strdup(device);
-
- filepath = resolve_path("/etc/yaboot.conf", devpath);
-
- fd = open(filepath, O_RDONLY);
- if (fd < 0) {
- free(filepath);
- filepath = resolve_path("/yaboot.conf", devpath);
- fd = open(filepath, O_RDONLY);
-
- if (fd < 0)
- return 0;
+ struct yaboot_state *state = conf->parser_info;
+ struct fixed_pair {
+ const char *image;
+ const char *initrd;
+ };
+ static const struct fixed_pair suse_fp32 = {
+ .image = "/suseboot/vmlinux32",
+ .initrd = "/suseboot/initrd32",
+ };
+ static const struct fixed_pair suse_fp64 = {
+ .image = "/suseboot/vmlinux64",
+ .initrd = "/suseboot/initrd64",
+ };
+ const struct fixed_pair *suse_fp;
+
+ /* fixup for bare values */
+
+ if (!name)
+ name = value;
+
+ if (!state->globals_done && conf_set_global_option(conf, name, value))
+ return;
+
+ if (!conf_param_in_list(state->known_names, name))
+ return;
+
+ state->globals_done = 1;
+
+ /* image */
+
+ if (streq(name, "image")) {
+ const char *g_boot = conf_get_global_option(conf, "boot");
+ const char *g_part = conf_get_global_option(conf, "partition");
+
+ /* First finish any previous image. */
+
+ if (state->opt->boot_image_file)
+ yaboot_finish(conf);
+
+ /* Then start the new image. */
+
+ if (g_boot && g_part) {
+ char* dev = talloc_asprintf(NULL, "%s%s", g_boot,
+ g_part);
+
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, dev);
+ state->desc_image = talloc_asprintf(state->opt,
+ "%s%s", dev, value);
+ talloc_free(dev);
+ } else if (g_boot) {
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, g_boot);
+ state->desc_image = talloc_asprintf(state->opt,
+ "%s%s", g_boot, value);
+ } else {
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, conf->dc->device_path);
+ state->desc_image = talloc_strdup(state->opt, value);
+ }
+
+ return;