aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-10-24Cleanup: gensquashfs: remove tree walk for force-uid/gidDavid Oberhollenzer
If the --force-uid or --force-gid flags are used, don't do a recursive tree walk after the fact, instead simply apply the settings at the source (e.g. tree iterator). Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-10-20Cleanup: gensquashfs: merge xattr scanning codeDavid Oberhollenzer
The fstree from file and directory xattr scanning code essentially do the same thing now. Except the later also _optionally_ reads xattrs from a directory source. Merge the two code paths. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-10-20gensquashfs: apply xattr file also when using a pack fileDavid Oberhollenzer
When reading a directory tree from a description file, we already scan do selinux relabeling if applicable. The same code path can be used to apply xattr from an xattr file, if present. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-10-11libsqfs: Rework the buffer advance logic for sqfs_istream_tDavid Oberhollenzer
Remove the asserts. If we eat more data than present, reset the offset and count to zero. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19libsqfs: Add a helper function for turning an inode into a dir entryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19libsqfs: Make sure directory iterators always set the size for linksDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19libtar: accept an sqfs_dir_entry_t instead of a struct statDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19sqfs2tar: replace hierarchy extraction with nested iteratorsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19Add pwd and path dependent prompt to browser exampleDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19Fix example code to use iterator/stream based APIDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19libsqfs: Expose the directory reader cache query functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-19libsqfs: Add a SquashFS implementation of the dir_iterator_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: Cleanup readdir state structDavid Oberhollenzer
There is no need to keep a copy of the state data internally. If the external user wants to reset/rewind, they can simply keep a copy of the old state, now that it is completely transparent. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: externalize the dir reader stateDavid Oberhollenzer
Instead of holding the state internally, move it outside and let the user pass it in. This allows processing multiple directories and going back and forth between them, while also simplifying the dir reader internals. The sqfs_dir_reader_get_inode function can also be made more generic to accept a reference instead of being fully state dependent. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: Remove sqfs_dir_reader_t functions unused in the code baseDavid Oberhollenzer
Those functions are only used in the example code, we remove them for now to make restructuring easier and fix the examples later. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: dir reader: encapsulate internal state in a separate objectDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: Internalize sqfs_dir_reader_find functionDavid Oberhollenzer
The only user in the code base is sqfs_dir_reader_find_by_path. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15libsqfs: remove dir reader internal.h, sub hierarchyDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-15Move directory tree related code from libsquashfs to libcommonDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-09Fix: set no-hardlink flag for dir tree scanner test programsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-09libcommon: get rid of write_data_from_fileDavid Oberhollenzer
Modify gensquashfs to pack data using an istream wrapper, similar to tar2sqfs. To implement the no-tail-pack option, we need the file size, so we simply open a raw handle first, and query it (using libsquashfs API) and then create the stream wrapper. For the output side, we create a block-processor ostream wrapper and splice it. Since gensquashfs is the only, remaining user of the pack-a-file functon, we can then remove it from libcommon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08libtar: fix: do not include fnmatch.h directlyDavid Oberhollenzer
On platforms like Windows, we don't have fnmatch.h and a libcompat implementation is provided. Instead of including fnmatch.h, include compat.h which includes the propper headers, if available. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08Fix reference count of copied objectsDavid Oberhollenzer
Always set the reference count to 1 after creating a copy of an object. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08genquashfs: detect/filter hardlinks when scanning a directoryDavid Oberhollenzer
The new behavior is enabled by default (except on Windows) and needs to be turned off explicitly. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08Add a hard link detecting/filtering directory iteratorDavid Oberhollenzer
The reason this is implemented separately, instead of roling it into the recursive iterator, is so that we can do additional filtering in between. For instance, we can rewrite the path and the hard link path will match up, or if we remove nodes from the hierarchy, we won't end up with a hard link pointing outside. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08libsqfs: bring sqfs_file_t in line with stream APIDavid Oberhollenzer
Rename the open function to sqfs_file_open, use an argument for the return pointer and pass back and error number on failure. Also add an inermediate function to open an sqfs_file_t using a handle, similar to the stream API. The get_file_size function is moved to the native wrappers and some of the implementation is cleaned up a little. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08Update CHANGELOG.mdDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03coverity: fix: remove dead codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03coverity: fix: resource leak in error pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03coverity: fix: potential null-pointer dereferenceDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03coverity: fix: use-after-free in error pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03Bump coverity scan versionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03gensquashfs: fix file path for glob directory scanningDavid Oberhollenzer
If we glob a directory, the generated entries can be added to a virtual sub directory, that does not corespond to the original layout. If we try to use those virtual paths for packing files, it will fail, so we need to remove that prefix to reconstruct the original path. Second, the glob operation allows us to select a sub-directory of the pack-dir. This prefix-path is stripped away when scanning the entries. We need to add it back to get the original, pack-dir relative file paths. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-01gensquashfs: add a test for fstree_from_dir file source pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-31gensquashfs: use generic integer parsing helpersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-31Document decimal integer parsing helpers, add an octal variantDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-18Add an inode fieled to sqfs_dir_entry_tDavid Oberhollenzer
This might be needed externally for things like hard link detection. For the unix implementation, store the actual inode number here. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Add a data reader based sqfs_istream_t implementationDavid Oberhollenzer
To the sqfs_data_reader_t is added, an sqfs_istream_t implementation that internally reads through the data reader. The uses of the data_reader_dump function are removed and the function is subsequently removed from libcommon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Split recursive directory iteratorDavid Oberhollenzer
The recursive part and the filter part are split up, the recursive iterator wrapper is moved into libsquashfs and the libio iterator is modified to use that internally instead of implementig the recursion step. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Move dir_iterator_t from libio into libsquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Refactor: rename dir_iterator_t to sqfs_dir_iterator_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Implement pen_file_ro method in native dir iteratorsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10libio: dir iterator: merge common code paths for initializationDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Add documentation to sqfs_dir_entry_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10tar2sqfs: Add option to exclude filesRichard Weinberger
Using --exclude or -E it is now possible to exclude files from the input tar stream. The options can be used multiple times. Signed-off-by: Richard Weinberger <richard@nod.at>
2023-07-10Move sqfs_dir_entry_t code from libio into libsquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Refactor: rename dir_entry_t to sqfs_dir_entry_tDavid Oberhollenzer
Exact operation performed: git ls-files -z | \ xargs -0 sed -i -e 's/dir_entry_t/sqfs_dir_entry_t/g Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Refactor: rename sqfs_dir_entry_t to sqfs_dir_node_tDavid Oberhollenzer
Exact operation performed: git ls-files -z | \ xargs -0 sed -i -e 's/sqfs_dir_entry_t/sqfs_dir_node_t/g' Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Consolidate some of the stray integer parsersDavid Oberhollenzer
There are several ad-hoc int/uint parsers scattered around the code, add a single helper function for that task and replace the multiple instances. A simple white-box test case is added for the utility function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: general cleanup after restructuring the parsing codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>