From 2285036e10863aba48dc6eed3c1a791118d11956 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 28 Apr 2023 19:36:56 +0200 Subject: 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 --- bin/gensquashfs/src/fstree_from_dir.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'bin/gensquashfs/src/fstree_from_dir.c') 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; -} -- cgit v1.2.3