summaryrefslogtreecommitdiffstats
path: root/discover/yaboot-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/yaboot-parser.c
parent5444648fe1ff9b79f3db5ee6feadd51341f59d71 (diff)
downloadtalos-petitboot-45e92aa32a80fdbbf5ad3ad64e34b1ac872018ef.tar.gz
talos-petitboot-45e92aa32a80fdbbf5ad3ad64e34b1ac872018ef.zip
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/yaboot-parser.c')
-rw-r--r--discover/yaboot-parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
index 0a66e8d..f51d2c6 100644
--- a/discover/yaboot-parser.c
+++ b/discover/yaboot-parser.c
@@ -313,8 +313,10 @@ static int yaboot_parse(struct discover_context *dc, char *buf, int len)
return 1;
}
-struct parser __yaboot_parser = {
+static struct parser yaboot_parser = {
.name = "yaboot",
.parse = yaboot_parse,
.filenames = yaboot_conf_files,
};
+
+register_parser(yaboot_parser);
OpenPOWER on IntegriCloud