diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-28 19:36:56 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-29 00:26:32 +0200 |
commit | 2285036e10863aba48dc6eed3c1a791118d11956 (patch) | |
tree | d94808261eb23df4c25db3c6de6dd45df2e692c7 /bin/gensquashfs/src/mkfs.c | |
parent | 46b01473eee7301cb7b49533af16abe0ee15c286 (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/mkfs.c')
-rw-r--r-- | bin/gensquashfs/src/mkfs.c | 18 |
1 files changed, 15 insertions, 3 deletions
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; |