summaryrefslogtreecommitdiffstats
path: root/discover/kboot-parser.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-03-18 14:23:23 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-29 14:41:04 +1000
commit45e92aa32a80fdbbf5ad3ad64e34b1ac872018ef (patch)
tree2753fb3912c07d23f3e2f622c05043f55c8f24c9 /discover/kboot-parser.c
parent5444648fe1ff9b79f3db5ee6feadd51341f59d71 (diff)
downloadtalos-petitboot-45e92aa32a80fdbbf5ad3ad64e34b1ac872018ef.zip
talos-petitboot-45e92aa32a80fdbbf5ad3ad64e34b1ac872018ef.tar.gz
parsers: dynamically register parsers
Currently, we require all parsers to be defined in an array in parsers.c. This change removes this requirement, by introducting a register_parser() macro, which adds a constructor to register the parser with the core parser infrastructure. Because each parser no longer resolves an undefined symbol, we need to use a `ld -r` object for libparser, instead of using libtool, which creates a .a (and hence has no parsers included). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/kboot-parser.c')
-rw-r--r--discover/kboot-parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/discover/kboot-parser.c b/discover/kboot-parser.c
index e602dc4..884658e 100644
--- a/discover/kboot-parser.c
+++ b/discover/kboot-parser.c
@@ -157,9 +157,11 @@ static int kboot_parse(struct discover_context *dc, char *buf, int len)
return 1;
}
-struct parser __kboot_parser = {
+static struct parser kboot_parser = {
.name = "kboot",
.parse = kboot_parse,
.filenames = kboot_conf_files,
.resolve_resource = resolve_devpath_resource,
};
+
+register_parser(kboot_parser);
OpenPOWER on IntegriCloud