diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-22 14:45:32 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-22 14:45:32 +0100 |
commit | 168ef9be32ad754d7bcb38ed70787237fc12630d (patch) | |
tree | 39d567fa667b2f170783329a07481769dd538d43 /bin/gensquashfs/mkfs.h | |
parent | 61a0dd71c4b69c21ee4aacdc0459dba58504a24a (diff) |
Move gensquashfs specific code from libfstree to gensquashfs
The "from dir" and from "from file" code, as well as the "sort file"
code is specific to gensquashfs, so move them there and the test
cases as well.
The medium term idea is to reduce libfstree to a stub, merge it into
the generic writer and ultimately hoist that into libsquashfs.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/mkfs.h')
-rw-r--r-- | bin/gensquashfs/mkfs.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/gensquashfs/mkfs.h b/bin/gensquashfs/mkfs.h index 33ba707..53fb018 100644 --- a/bin/gensquashfs/mkfs.h +++ b/bin/gensquashfs/mkfs.h @@ -98,4 +98,40 @@ int selinux_relable_node(void *sehnd, sqfs_xattr_writer_t *xwr, void selinux_close_context_file(void *sehnd); +/* + Parses the file format accepted by gensquashfs and produce a file system + tree from it. File input paths are interpreted as relative to the current + working directory. + + On failure, an error report with filename and line number is written + to stderr. + + Returns 0 on success. + */ +int fstree_from_file(fstree_t *fs, const char *filename, + const char *basepath); + +int fstree_from_file_stream(fstree_t *fs, istream_t *file, + const char *basepath); + +/* + Recursively scan a directory to build a file system tree. + + Returns 0 on success, prints to stderr on failure. + */ +int fstree_from_dir(fstree_t *fs, tree_node_t *root, + const char *path, scan_node_callback cb, void *user, + unsigned int flags); + +/* + Same as fstree_from_dir, but scans a sub-directory inside the specified path. + + Returns 0 on success, prints to stderr on failure. + */ +int fstree_from_subdir(fstree_t *fs, tree_node_t *root, + const char *path, const char *subdir, + scan_node_callback cb, void *user, unsigned int flags); + +int fstree_sort_files(fstree_t *fs, istream_t *sortfile); + #endif /* MKFS_H */ |