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/mkfs.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'bin/gensquashfs/src/mkfs.c') diff --git a/bin/gensquashfs/src/mkfs.c b/bin/gensquashfs/src/mkfs.c index 683077b..f2973b6 100644 --- a/bin/gensquashfs/src/mkfs.c +++ b/bin/gensquashfs/src/mkfs.c @@ -166,10 +166,22 @@ int main(int argc, char **argv) } if (opt.infile == NULL) { - if (fstree_from_dir(&sqfs.fs, sqfs.fs.root, opt.packdir, - NULL, NULL, opt.dirscan_flags)) { + dir_iterator_t *dir = NULL; + dir_tree_cfg_t cfg; + int ret; + + memset(&cfg, 0, sizeof(cfg)); + cfg.flags = opt.dirscan_flags; + cfg.def_mtime = sqfs.fs.defaults.mtime; + + dir = dir_tree_iterator_create(opt.packdir, &cfg); + if (dir == NULL) + goto out; + + ret = fstree_from_dir(&sqfs.fs, sqfs.fs.root, dir, NULL, NULL); + sqfs_drop(dir); + if (ret != 0) goto out; - } } else { if (read_fstree(&sqfs.fs, &opt, sqfs.xwr, sehnd)) goto out; -- cgit v1.2.3