summaryrefslogtreecommitdiffstats
path: root/discover/parser.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-04-16 16:58:18 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-29 14:41:04 +1000
commit5be946cda7b8e2271ade6188ca3f5dc068826619 (patch)
treea62a64792bb61aa57c5d8dac36c7df9756d01ef8 /discover/parser.c
parent4e8b779626da98e2896efbb2df99b64f76e878f6 (diff)
downloadtalos-petitboot-5be946cda7b8e2271ade6188ca3f5dc068826619.tar.gz
talos-petitboot-5be946cda7b8e2271ade6188ca3f5dc068826619.zip
discover: Change parsers to emit resources rather than filenames
This change switches the parsers over to populate the resources in discover_boot_option, rather than the string parameters in boot_option. To do this, we need a few things: * Add struct resources to discover_boot_option for the boot_image, initrd and icon data. * Have the parsers populate the resources, rather than the strings. Currently, parsers can all use the devpath resource type. * Add a resolve_resource callback to parsers; this is how the device handler will attempt to resolve resources. * Change load_file to load_url, as we should be only accessing (resolved) resources by URLs. This then allows us to remove the mount map, and associated lookup code, as well as the UUID and label links to devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/parser.c')
-rw-r--r--discover/parser.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/discover/parser.c b/discover/parser.c
index 1f3674d..462d614 100644
--- a/discover/parser.c
+++ b/discover/parser.c
@@ -77,12 +77,17 @@ err_close:
return -1;
}
+static char *local_path(struct discover_context *ctx,
+ const char *filename)
+{
+ return join_paths(ctx, ctx->device->mount_path, filename);
+}
+
static void iterate_parser_files(struct discover_context *ctx,
const struct parser *parser)
{
const char * const *filename;
- const char *path, *url;
- unsigned int tempfile;
+ const char *path;
if (!parser->filenames)
return;
@@ -91,12 +96,7 @@ static void iterate_parser_files(struct discover_context *ctx,
int rc, len;
char *buf;
- url = resolve_path(ctx, *filename, ctx->device->device_path);
- if (!url)
- continue;
-
- path = load_file(ctx, url, &tempfile);
-
+ path = local_path(ctx, *filename);
if (!path)
continue;
@@ -105,12 +105,7 @@ static void iterate_parser_files(struct discover_context *ctx,
parser->parse(ctx, buf, len);
talloc_free(buf);
}
-
- if (tempfile)
- unlink(path);
-
}
-
}
void iterate_parsers(struct discover_context *ctx)
OpenPOWER on IntegriCloud