X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fparser.c;fp=discover%2Fparser.c;h=9fe1925d94c44a283f0065f89f550401373b8347;hb=91ce1a8f8863d8f740188236f138421d17292d6c;hp=5598f963e236d2c6806aa0ac9166b242c18d266a;hpb=3dfa4123bdf987aaa0e4bfd73d436c6bab0184ce;p=petitboot diff --git a/discover/parser.c b/discover/parser.c index 5598f96..9fe1925 100644 --- a/discover/parser.c +++ b/discover/parser.c @@ -128,6 +128,22 @@ out: return -1; } +int parser_scandir(struct discover_context *ctx, const char *dirname, + struct dirent ***files, int (*filter)(const struct dirent *), + int (*comp)(const struct dirent **, const struct dirent **)) +{ + char *path; + int n; + + path = talloc_asprintf(ctx, "%s%s", ctx->device->mount_path, dirname); + if (!path) + return -1; + + n = scandir(path, files, filter, comp); + talloc_free(path); + return n; +} + void iterate_parsers(struct discover_context *ctx) { struct p_item* i;