Age | Commit message (Collapse) | Author |
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The idea is as follows: Initially let the user submit blocks until the
queue is filled, then kick of the threads. Every thread will end up
getting a block without any waits until they completely deplete the
queue. Assuming the threads take longer to process the data than it
takes the main thread to do I/O and submit new blocks, the queue should
stay mostly filled with minimal wait times.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
- ONLY manipulate the back log counter in the main thread.
- Fix the order of operations when submitting blocks.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The liblzo compression functions don't do any bounds checking,
instead they expect the destination buffer to be large enough
to hold the worst case encoding.
This commit modifies the lzo compressor to use a scratch buffer
for compression (with worst case size) and only copy to the actual
destination if the result fits.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The zstd compress function returns an error code if it cannot fit the
compressed data into the given destination buffer.
This commit adds a check for this error and reports that the
libsquashfs compressor implementation was unable to shrink the input
instead of claiming a fatal error happened.
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>
|
|
When converting a SquashFS image to a tarball, it makes no sense to
refuse conversion if the filename is considered evil by the OS.
This patch adds an option to is_filename_sane to check if the OS has
a problem with the given file name. sqfs2tar sets it to false and
converts everything while rdsquashfs sets it to true when unpacking.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
It's cleaner, more stable and works pretty much the same way as the
pthread version. The downside is that the minimum target for the
library is now Windows Vista, or Server 2008. But both are over a
decade old anyway, so this shouldn't be an issue.
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>
|
|
Move "do block" function over to the rest of the block related
code and internalizie the pthread worker structure.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
If a signal is sent to a process, the POSIX spec says that ANY thread
could be picked ARBITRARILY to handle the signal. In our case this could
be one of the internal worker threads.
The problem here is that an unsuspecting user of the library might
suddenly have their signal handler run in parallel to their main thread
and run into weird concurrency issues, because they didn't expect that
to happen.
In fact, the libsquashfs API tries to be transparent about whether or
not it uses a thread pool internally and does everything other than
number crunching (e.g. I/O that may happen through user supplied
callbacks) in the same thread as the one that submitts the blocks.
Unfortunately, pthread doesn't have a way to set a signal mask for the
new thread and setting it inside the thread is racy (i.e. a signal might
be delivered before the worker thread sets the mask).
The only portable and non-racy way to do this, is to disable all signals
in the calling thread that sets up the data writer, create the threads
(which will inherit the mask) and then resetore the previous signal mask,
hoping for the best.
The downside to this is that signals may be lost in that short time.
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>
|
|
Instead of returning the ID through a pointer and an error code as
return status, return a single int that could be a compressor ID
(positive values) or an error code (negative values).
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 were only a hand full of instances outside libsquashfs that used
the alloc code. In most cases, the thing allocated hat its size derived
from something already in memory anyway, so it is safe to assume its
size fits into a size_t.
At the same time, the opencoded Windows path conversion functions are
all unified into a single helper 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>
|
|
The check needs to include 1M, which is still a valid block size.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
- Add an explicit "you're holding it wrong" error code.
- Consistently return error codes and not have some special places
where -1 is returned.
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>
|
|
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 liblzo2 library is licensed under GPLv2, so it is not possible to
distribute binaries of libsquashfs that link against liblzo2 under
LGPL.
This commit moves the LZO compressor implementation to libcommon,
where this isn't a problem, since the tools themselves are licensed
under GPLv3.
It removes the ability of libsquashfs to read or generate LZO compressed
SquashFS images, but the tools still can.
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>
|
|
- Make sure the mockup constant for AT_FDCWD is actualy an int
- Don't use %lld printf format specified, mscrt doesn't have that
- On 64 bit windows, use %I64u format specified for size_t
- Seperate the overflow macro stuff from the form specifier stuff
- Move the whole thing to compat.h and clean it up a little so
it becomes readable.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
In most cases, including unistd.h and fcntl.h was a left over anyway.
In the cases where it was not, move it to compat.h.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Not pretty, but definitely prettier than #ifdef hell.
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>
|
|
As usual, Windows has things different and is the platform where
the problem was actually discovered.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
- We can only pack directories and files anyway.
- What file modes should we use?
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
AFAIK the only thing we can actually unpack on Windows is regular
files and directories, so only do that.
Furthermore, we have no way of setting Unix file attributes, so
skip that.
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>
|