- static const char *const conf_names[] = {
- "/etc/kboot.conf",
- "/etc/kboot.cnf",
- };
- struct kboot_context *kboot_ctx;
- int fd, len, rc;
- unsigned int i;
- struct stat stat;
-
- rc = 0;
- fd = -1;
-
- kboot_ctx = talloc_zero(ctx, struct kboot_context);
- kboot_ctx->discover = ctx;
-
- for (i = 0, len = 0; i < sizeof(conf_names) / sizeof(conf_names[0]);
- i++) {
- char *filepath = resolve_path(kboot_ctx, conf_names[i],
- ctx->device_path);
-
- pb_log("%s: try: %s\n", __func__, filepath);
-
- fd = open(filepath, O_RDONLY);
- if (fd < 0) {
- pb_log("%s: open failed: %s : %s\n", __func__, filepath,
- strerror(errno));
- continue;
- }
- if (fstat(fd, &stat)) {
- pb_log("%s: fstat failed: %s : %s\n", __func__,
- filepath, strerror(errno));
+ struct conf_context *conf;
+ struct list *found_list;
+ const char * const *filename;
+
+ /* Support block device boot only at present */
+ if (dc->event)
+ return -1;
+
+ conf = talloc_zero(dc, struct conf_context);
+ if (!conf)
+ return -1;
+
+ found_list = talloc(conf, struct list);
+ if (!found_list)
+ return -1;
+ list_init(found_list);
+
+ conf->dc = dc;
+ conf->global_options = kboot_global_options,
+ conf_init_global_options(conf);
+ conf->get_pair = conf_get_pair_equal;
+ conf->process_pair = kboot_process_pair;
+ conf->parser_info = (void *)kboot_ignored_names;
+
+ for (filename = kboot_conf_files; *filename; filename++) {
+ int len, rc;
+ char *buf;
+
+ if (!parser_is_unique(dc, dc->device, *filename, found_list))