4 #include "pb-protocol/pb-protocol.h"
7 #include "device-handler.h"
9 #include "parser-utils.h"
11 extern struct parser __start_parsers[], __stop_parsers[];
13 void iterate_parsers(struct discover_context *ctx)
15 struct parser *parser;
17 pb_log("trying parsers for %s\n", ctx->device_path);
19 for (parser = __start_parsers; parser < __stop_parsers; parser++) {
20 pb_log("\ttrying parser '%s'\n", parser->name);
21 /* just use a dummy device path for now */
22 if (parser->parse(ctx))
25 pb_log("\tno boot_options found\n");
28 static int compare_parsers(const void *a, const void *b)
30 const struct parser *parser_a = a, *parser_b = b;
32 if (parser_a->priority > parser_b->priority)
35 if (parser_a->priority < parser_b->priority)
41 void parser_init(void)
43 /* sort our parsers into descending priority order */
44 qsort(__start_parsers, __stop_parsers - __start_parsers,
45 sizeof(struct parser), compare_parsers);