Commit graph

109 commits

Author SHA1 Message Date
Con Kolivas 36e09f206e Begin massive read changes to support using temporary file for STDIN. 2011-03-14 20:22:45 +11:00
Con Kolivas 684959efed Add fields for temporary input buffer and clamp memory accordingly in preparation. 2011-03-14 14:47:26 +11:00
Con Kolivas 5f7a03932b Calculate the total expected size progressively and show it when it's not known. 2011-03-14 13:32:36 +11:00
Con Kolivas 9e772d3140 Make ALL decompression use temporary in-ram buffer whenever possible. 2011-03-14 12:48:40 +11:00
Con Kolivas 27d7c2a031 Tidy. 2011-03-14 12:23:12 +11:00
Con Kolivas 0fe3213a47 Write to physical files if we cannot fit the decompression in ram. 2011-03-14 12:15:54 +11:00
Con Kolivas 37009e2ac5 Make sure to read on an fd if that's what we're supposed to be doing. 2011-03-14 11:25:04 +11:00
Con Kolivas b644240152 write_1g always uses control->fd_out so don't pass fd to it. 2011-03-14 11:15:35 +11:00
Con Kolivas 4a6fa7602f Begin decompressing to stdout via temporary buffer by creating a read/write wrapper. 2011-03-14 10:07:51 +11:00
Con Kolivas f2ddd9022c Ignore the eof flag if the file size is known. 2011-03-13 21:31:03 +11:00
Con Kolivas 8756fe91e2 Enable decompression when file has been chunked stdout and display progress only when expected size is known. 2011-03-13 17:52:23 +11:00
Con Kolivas 6d0ac95170 Remove extra locking that does nothing. 2011-03-13 12:12:37 +11:00
Con Kolivas 6ac74aa9f0 Create a flag to know when the temporary output buffer is in use, in preparation for when we use it on decompression. 2011-03-13 08:34:06 +11:00
Con Kolivas 2f87f62696 Make the tmp out buf slightly larger to account for incompressible data, and check for buffer overflows. 2011-03-13 08:16:46 +11:00
Con Kolivas 11ea12d3ce Forgot to test for TEST_ONLY. 2011-03-12 23:07:52 +11:00
Con Kolivas d067a6ea9e Implement the real workings of writing to a temporary buffer before flushing to stdout. 2011-03-12 22:46:57 +11:00
Con Kolivas 7fbec0a783 Prepare to write compressed output by flushing stdout after each chunk is compressed. 2011-03-12 19:56:08 +11:00
Con Kolivas c75a50f723 Being modifying write_1g function to be able to write to a temporary buffer instead of straight to fd_out.
Split out make_magic to be able to write magic wherever we want later.
2011-03-12 14:13:28 +11:00
Con Kolivas 9444441d51 Modify maximum ram usable when stdout is being used in preparation for temporary in-ram file during stdout and fix summary shown and 32 bit limits. 2011-03-12 12:19:02 +11:00
Con Kolivas fe68b9a3f7 Institute writing and reading of 0.6 file format for compress/decompress. 2011-03-12 11:17:11 +11:00
Con Kolivas 3a00735c24 Fix locking.
Patch by <mike@zentific.com>
2011-03-11 12:29:27 +11:00
Con Kolivas a8dcecd721 fix-undefined-mutex-behavior-rename-stream-variable.
Patch by <mike@zentific.com>
2011-03-11 08:35:15 +11:00
Con Kolivas 643054ae22 Fix threading errors.
Patch by <mike@zentific.com>
2011-03-11 08:33:35 +11:00
Con Kolivas fb2de8cb35 Remove unused offset variable. 2011-03-09 13:33:53 +11:00
Con Kolivas 1b965167ff Remove unused offset variable. 2011-03-09 13:30:20 +11:00
Con Kolivas 11052f56f3 Ignore the lzo_1 return value entirely. 2011-03-09 13:25:33 +11:00
Con Kolivas 2db75fe408 Get rid of trailing whitespace 2011-03-09 08:50:46 +11:00
Con Kolivas 1a7c409e10 header-mangling-part-X-move-all-headers-defines-into 2011-03-09 08:37:26 +11:00
Con Kolivas 99c3ea2ab9 header-mangling-part-3-remove-ugly-hacks-for-liblrzi 2011-03-09 08:36:07 +11:00
Con Kolivas 1511c27aad header-mangling-part-2-move-all-function-prototypes 2011-03-09 08:34:44 +11:00
Con Kolivas f6f0a25ef6 rebase-of-function-split-and-control-additions-to-fu 2011-03-09 08:32:14 +11:00
Con Kolivas 38eca38743 Unify maxram allocation and limit threads when there isn't enough ram. 2011-03-07 13:23:14 +11:00
Con Kolivas 3433438a8e Structs in stream.c can be static. 2011-02-26 20:11:43 +11:00
ckolivas f9f880908c Remove the slightly fragile exponential growth buffer size.
It was only speeding up compression a small amount, yet adversely affected compression and would segfault due to the size not being consistent on successive passes.
2011-02-25 10:10:22 +11:00
Con Kolivas dcf62d11a0 Make sure not to make the bufsize larger than the limit.
Drop the page rounding since it is of no demonstrable benefit but adds complexity.
2011-02-24 12:20:06 +11:00
Con Kolivas 22ae326d01 Make it always clear that a failure to allocate a buffer has occurred on compression. 2011-02-24 11:52:30 +11:00
Con Kolivas 402dbbed65 Make sure we don't start shrinking the buffer size. 2011-02-23 15:34:43 +11:00
Con Kolivas 94673d3fe3 Change the LZO testing option to be a bool on/off instead of taking a confusing parameter.
Make the lzo testing message simpler and only appear when max verbose mode is enabled.
2011-02-23 01:15:18 +11:00
Con Kolivas 011344753a With lzma and zpaq, the compression overhead per thread is significant.
As we can work out what that compression overhead is, we can factor that into testing how much ram we can allocate.
There is no advantage to running multiple threads when there is no compression back end so drop to 1 only.
Limit ram for compression back end to 1/3 ram regardless for when OSs lie due to heavy overcommit.
2011-02-22 15:19:31 +11:00
Con Kolivas bcb857d934 Don't add extra threads for single-threaded decompression case. 2011-02-22 00:58:55 +11:00
Con Kolivas bb33f7571c Multi-threading speed ups.
Add one more thread on compression and decompression to account for the staggered nature of thread recruitment.
Make the initial buffer slightly smaller and make it progressively larger, thus recruiting threads sooner and more evenly.
This also speeds up decompression for the same reason.
Check the amount of memory being used by each thread on decompression to ensure we don't try to recruit too much ram.
2011-02-22 00:49:50 +11:00
Con Kolivas 88e3df6af1 Print perror before unlinking files.
Join common parts of fatal errors.
Update copyright notices.
Small improvement to visual output.
2011-02-21 16:11:59 +11:00
Con Kolivas a7b4708bd2 Use a different failure mode for when perror is unlikely to be set.
Add 2 unlikely wrappers.
2011-02-21 14:51:20 +11:00
Con Kolivas 74df2b5973 Minor updates to man pages, lrzip.conf example file.
Update main help screen to include environment settings.
Update to respect $TMP environment variable for TMP files.
Updated control structure to include tmpdir pointer.
Update lrzip.conf parser to respect -U -M options.
Update lrzip.conf example to include new parameters.
Reorder main Switch loop in main.c for readability.
Have MAXRAM and control.window be exclusive. MAXRAM wins.
Have UNLIMITED and control.window be exclusive. UNLIMITED wins.
Have UNLIMITED and MAXRAM be exclusive. UNLIMITED wins.
Corrects heuristic computation in rzip.c which would override
MAXRAM or UNLIMITED if control.window set
Show heuristically computed control.window when computed.
Remove display compression level from control.window verbose output.
Update print_verbose format for Testing for incompressible data in stream.c
to omit extra \n.

Changes by Peter Hyman <pete@peterhyman.com>
2011-02-21 12:03:08 +11:00
Con Kolivas 57e25da244 Update copyright yeah in updated files. 2011-02-20 23:04:44 +11:00
Con Kolivas 626e0be281 Convert semaphore primitives to pthread_mutexes making them more portable, thus allowing multithreading to work on OSX. 2011-02-17 00:24:28 +11:00
Con Kolivas 05c5326df3 Revert "OSX doesn't support unnamed semaphores so to make it work, fake the threading by just creating the threads and waiting for them to finish."
This reverts commit b81542cea4.

Revert the change bypassing semaphores in OSX in preparation for changing the semaphores to mutexes.
2011-02-16 17:40:50 +11:00
Con Kolivas b81542cea4 OSX doesn't support unnamed semaphores so to make it work, fake the threading by just creating the threads and waiting for them to finish.
This is done by making the semaphore wrappers null functions on osx and closing the thread in the creation wrapper.
Move the wrappers to rzip.h to make this change clean.
2011-02-11 12:22:09 +11:00
Con Kolivas f2d33c00f8 Cast the mallocs to their variable type.
Check that read and write actually return greater than zero.
2011-02-11 11:46:58 +11:00
Con Kolivas 3879807865 Try limiting stream_read in unzip_literal and just returning how much was read. 2011-02-10 16:57:22 +11:00