Unmount devices with no bootloader conf files. Signed-off-by: Geoff Levand --- discover/device-handler.c | 9 ++++++--- discover/parser.c | 6 +++--- discover/parser.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -321,7 +321,6 @@ static int handle_add_event(struct devic return 0; } - handler->n_devices++; list_add(&handler->contexts, &ctx->list); talloc_set_destructor(ctx, destroy_context); @@ -331,9 +330,13 @@ static int handle_add_event(struct devic list_init(&ctx->device->boot_options); /* run the parsers */ - iterate_parsers(ctx); + rc = iterate_parsers(ctx); - discover_server_notify_add(handler->server, ctx->device); + if (rc) { + handler->n_devices++; + discover_server_notify_add(handler->server, ctx->device); + } else + talloc_free(ctx); return 0; } --- a/discover/parser.c +++ b/discover/parser.c @@ -10,7 +10,7 @@ extern struct parser __start_parsers[], __stop_parsers[]; -void iterate_parsers(struct discover_context *ctx) +int iterate_parsers(struct discover_context *ctx) { struct parser *parser; @@ -18,11 +18,11 @@ void iterate_parsers(struct discover_con for (parser = __start_parsers; parser < __stop_parsers; parser++) { pb_log("\ttrying parser '%s'\n", parser->name); - /* just use a dummy device path for now */ if (parser->parse(ctx)) - return; + return 1; } pb_log("\tno boot_options found\n"); + return 0; } static int compare_parsers(const void *a, const void *b) --- a/discover/parser.h +++ b/discover/parser.h @@ -22,6 +22,6 @@ enum generic_icon_type { void parser_init(void); -void iterate_parsers(struct discover_context *ctx); +int iterate_parsers(struct discover_context *ctx); #endif /* _PARSER_H */ --