aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs/src/fstree_from_dir.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-28 19:36:56 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-29 00:26:32 +0200
commit2285036e10863aba48dc6eed3c1a791118d11956 (patch)
treed94808261eb23df4c25db3c6de6dd45df2e692c7 /bin/gensquashfs/src/fstree_from_dir.c
parent46b01473eee7301cb7b49533af16abe0ee15c286 (diff)
gensquashfs: Dismantle the scan_dir wrapper
Create the directory iterator externally and pass it to fstree_from_dir. The unit test is also removed, because the heavy lifting is now done outside the function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/src/fstree_from_dir.c')
-rw-r--r--bin/gensquashfs/src/fstree_from_dir.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/bin/gensquashfs/src/fstree_from_dir.c b/bin/gensquashfs/src/fstree_from_dir.c
index 22493c5..b2d27f1 100644
--- a/bin/gensquashfs/src/fstree_from_dir.c
+++ b/bin/gensquashfs/src/fstree_from_dir.c
@@ -21,7 +21,7 @@ static sqfs_u32 clamp_timestamp(sqfs_s64 ts)
return ts;
}
-static int scan_dir(fstree_t *fs, tree_node_t *root, dir_iterator_t *dir,
+int fstree_from_dir(fstree_t *fs, tree_node_t *root, dir_iterator_t *dir,
scan_node_callback cb, void *user)
{
for (;;) {
@@ -84,23 +84,3 @@ static int scan_dir(fstree_t *fs, tree_node_t *root, dir_iterator_t *dir,
return 0;
}
-
-int fstree_from_dir(fstree_t *fs, tree_node_t *root, const char *path,
- scan_node_callback cb, void *user, unsigned int flags)
-{
- dir_iterator_t *dir;
- dir_tree_cfg_t cfg;
- int ret;
-
- memset(&cfg, 0, sizeof(cfg));
- cfg.flags = flags;
- cfg.def_mtime = fs->defaults.mtime;
-
- dir = dir_tree_iterator_create(path, &cfg);
- if (dir == NULL)
- return -1;
-
- ret = scan_dir(fs, root, dir, cb, user);
- sqfs_drop(dir);
- return ret;
-}