Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Make use of the helpers in libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Allow spaces between `-type` and the character, look it up
from a table instead of having `-type <char>` pairs in the
main table.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
- The ostream creation functions already have flag arguments,
but make them an sqfs_u32 instead of int.
- Add flag arguments to the istream functions, sanitzie and forward
them when opening the handle.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Report an error number from the implementations, change the users to
forward that error number (which also means libtar write header/link
now returns an error code) and all subsequent binaries to use
sqfs_perror() instead of relying on the function to print an error
internally.
Also, make sure to preserve errno/GetLastError() in the implementations
and print out a stringified error in sqfs_perror() if the error code
indicates an I/O error.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Having a function to interpret the flags and open a native file handle
simplifies the istream/ostream/file code which shares that decoding
part, particularly on windows where the character set needs to be
transformed.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
istream_t becomes sqfs_istream_t and ostream_t becomes sqfs_ostream_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
It has the same members, but with the added benefit that we already
have helper functions for it in libsquashfs and we can just hose
it directly into the xattr writer.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
In several places, there are ad-hoc istream_t implementations that
read from a memory buffer to test something else stacked on top.
This commit consolidates those ad-hoc implmentations into a proper
one in libio, and uses the chance to remove external files for some
older tests that rely on file I/O instead.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Because the dir_entry_t also has a flag for had links, the regular
node and hard-link node interface can be unified. This simplifies
the users of libfstree (gensquashfs, tar2sqfs) since we can simply
hose the entries from an iterator directly into the tree.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Move the error handling to the end of the function, make sure we
properly handle all allocation failures.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The glob function and everything associated is moved to a separate
file, the entry point exposed any the special case handling is removed
from the other callbacks in fstree_from_file.c
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The existing istream_t wrapper is mered into this one as well, we
can open the files via the iterators open_file_ro function. Unit
tests and tar2sqfs are modified accordingly.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
For regular iterator types, it's a no-op, for the tree iterator,
it skips the sub tree.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
A simple unit test is added that mainly checks for the behavior of
recursing into a sub-tree and only matching the children at the end,
but not reporting the parents that don't match. The behavior is
inteded to immitate the `find` command.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Piece together the prefix path and pass it to the iterator. That way,
we get the full target paths back from the iterator and can use those
directly in the callback for filtering.
We also no longer need the root node for fstree_from_dir (always tree
root) and the callback can no longer return an error state.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
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>
|
|
This way, we can remove the discard_node function and simplify the
scan_dir code further.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The logic was previously there to allow recursing into directories
that exist in the fstree and the scanned directory, but not create
new directories. Because the dir_tree_iterator_t supports reporting
contents but not directories (and does DFS), we can simply check if
the parent of the directory exists. Under normal DFS, it must exist,
because we created it earlier. If we are skipping the directory
entries, it only exists if it was there earlier and we can skip
entries that have a non-existant parent, retainint the old behavior.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
It is only used in the glob function, so assemble the path there and
jus tuse fstree_from_dir.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Limited unit testing for the flags is added, particularly the
abillity to recurse into sub-directories, but not report the
parents as individual entries.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When inserting the selected entry, the next_by_type pointer is
supposed to be cleared, but the code accidentaly broke up the
next pointer, removing the element from the tree.
Fixes: e1e655b02f6c54177f9070eeb221ab95c6d4e20f
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Instead of printing out error messages, return an errro ID and match
the behavior with the Windows implementation. Also, don't check first
if the struct stat says it is a link, the readlinkat() system call
will fail if it isn't. Avoid confusing the deputy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This is also the reason we need to lug around the original directory
path on Windows.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|