X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fparser.c;h=d0b0477ff5389050713005d4d582de98d16e17e0;hp=5b1a7abdab600656bc803721bef66f07bdcc9b88;hb=16ebe978aeced862dd877cfee81ac7604902fd55;hpb=ce5eab024583af5a4725503bad6ed2aee452b1aa diff --git a/discover/parser.c b/discover/parser.c index 5b1a7ab..d0b0477 100644 --- a/discover/parser.c +++ b/discover/parser.c @@ -1,30 +1,41 @@ #include -#include "pb-protocol/pb-protocol.h" +#include "types/types.h" +#include #include "device-handler.h" -#include "log.h" #include "parser.h" -extern struct parser kboot_parser; +#include "parser-utils.h" -/* array of parsers, ordered by priority */ -static struct parser *parsers[] = { - &kboot_parser, +struct parser __grub2_parser; +struct parser __kboot_parser; +struct parser __native_parser; +struct parser __yaboot_parser; + +static const struct parser *const parsers[] = { +// &__native_parser, + &__kboot_parser, + &__grub2_parser, + &__yaboot_parser, NULL }; void iterate_parsers(struct discover_context *ctx) { int i; + unsigned int count = 0; pb_log("trying parsers for %s\n", ctx->device_path); for (i = 0; parsers[i]; i++) { pb_log("\ttrying parser '%s'\n", parsers[i]->name); - /* just use a dummy device path for now */ - if (parsers[i]->parse(ctx)) - return; + count += parsers[i]->parse(ctx); } - pb_log("\tno boot_options found\n"); + if (!count) + pb_log("\tno boot_options found\n"); +} + +void parser_init(void) +{ }