]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser.c
travis: Enable ppc64le Travis builds
[petitboot] / discover / parser.c
index 5598f963e236d2c6806aa0ac9166b242c18d266a..9fe1925d94c44a283f0065f89f550401373b8347 100644 (file)
@@ -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;