From 4390eddccfb3918291e7b8e4d708411f9b828c04 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 29 Apr 2023 03:12:06 +0200 Subject: gensquashfs: use prefix functionality for glob_files target node Piece together the prefix path and pass it to the iterator. That way, we get the full target paths back from the iterator and can use those directly in the callback for filtering. We also no longer need the root node for fstree_from_dir (always tree root) and the callback can no longer return an error state. Signed-off-by: David Oberhollenzer --- lib/fstree/src/add_by_path.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/fstree/src/add_by_path.c b/lib/fstree/src/add_by_path.c index f204836..344b586 100644 --- a/lib/fstree/src/add_by_path.c +++ b/lib/fstree/src/add_by_path.c @@ -14,24 +14,17 @@ tree_node_t *fstree_add_generic(fstree_t *fs, const char *path, const struct stat *sb, const char *extra) -{ - return fstree_add_generic_at(fs, fs->root, path, sb, extra); -} - -tree_node_t *fstree_add_generic_at(fstree_t *fs, tree_node_t *root, - const char *path, const struct stat *sb, - const char *extra) { tree_node_t *child, *parent; const char *name; if (*path == '\0') { - child = root; + child = fs->root; assert(child != NULL); goto out; } - parent = fstree_get_node_by_path(fs, root, path, true, true); + parent = fstree_get_node_by_path(fs, fs->root, path, true, true); if (parent == NULL) return NULL; -- cgit v1.2.3