Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The only user in the code base is sqfs_dir_reader_find_by_path.
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Start with a common prefix "sqfs_native_file_*"
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
It is mainly a very thin wrapper on top of the block processor so far.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
By adding additional close/duplicate primitives, the remaining, mostly
identical istream/ostream/file code is mostly identical between Windows
and Unix and be merged, mostly without stitches.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
On Unix like OSes, this saves/restores errno, on Windows both errno
and GetLastError state are saved/restored.
This should make it simpler to preserve that across function calls.
Additionally, while tracking down uses of GetLastError, some places
where the error code was printed out directly where replaced with
instances of w32_perror.
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>
|
|
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>
|
|
Similar to the sqfs_istream_t & sqfs_ostream_t interfaces.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
For now, only the interfaces and helper functions are moved, the
concrete implementations remain in libio.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Instead of a separate append-sparse function, simply accept NULL
as an input for append. For both Unix and Win32, a fallback needs
to be implemented. For XFRM, we can just memset the input buffer
to zero, same for the libsquashfs data writer.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The common pattern is used in rdsquashfs and sqfs2tar, move the code
to libsquashfs.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The structure and functions are renamed to sqfs_xattr_* instead,
an additional helper is added to accept an encoded xattr.
Documentation and unit test are added as well.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The idea of the block align feature was to allow micro-managing that
some files are forcefully aligned to 1k/4k ("device block") boundaries,
hoping to improve access time at the cost of data density. The feature
was not exposed in the tools for a long time and eventuall added to the
sort file. Measurement and experimentation showed, that it in fact
worsened the read performance on a test system with an old micro SD
card as the bottle neck.
The feature is removed, and if needed, can be brought back simply by
wrapping/sub-classing the default block writer, if need be..
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>
|
|
Implement grab/drop functions to increase/decrease reference count
and destroy the object if the count drops to 0.
Make sure that all objects that maintain internal references actually
grab that reference, duplicate it in the copy function, drop it in
the destroy handler.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
mksquashfs generates extended inodes if a directory contains 256
entries. libsquashfs so far only generated extended inodes if there
is no other way to encode it. Mimic the behaviour of mksquashfs by
adding a threshold.
For this to work, the "sqfs_inode_set_xattr_index" function has to
be changed to not immediately try to demote inodes to basic types.
The fstree serialization is modified to do that itself if the index
is 0xFFFFFFFF and the target is not a directory inode.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
On Linux or BSD distributions we have a native version installed
via package manager. On Windows, we can just build it from source
like the other libraries.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
When (during fragment deduplication) a fragment block is read back
from disk and unpacked, it can happen that it is _exactly_ the
given block size. The bounds check did '>=' instead of '>' and
failed in that case with a "data corruption" error.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Initialize the output compressor pointer to NULL, so if the function
fails, the value is propperly initialized to a NULL pointer instead
of relying on the function user to initialize it.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Slightly modify the byte-for-byte comparison function to compare an
arbitrary range in a file and move it to libutil. Instead of calling
it for each block in the block writer, simply let it check an entire
range in the block writer and compute the range position/size of the
reference ahead, before looking for potential matches.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Instead of open coding it, use the array_t type from libutil.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Test against various invariants:
- Every non-root node must have a name
- The root node muts not have a name
- The name must not be ".." or "."
- The name must not contain '/'
- The loop that chases parent pointers must terminate, i.e. we must
never reach the starting state again (link loop).
Furthermore, make sure the sum of all path components plus separators
does not overflow.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|