Commit graph

195 commits

Author SHA1 Message Date
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 e5dfd2d9d8 header-mangling-part-1-move-functions-out-of-headers 2011-03-09 08:33:44 +11:00
Con Kolivas f6f0a25ef6 rebase-of-function-split-and-control-additions-to-fu 2011-03-09 08:32:14 +11:00
ckolivas 59e5bc0492 Remove all open coded strerrors when they're going to be shown by fatal(). 2011-03-08 12:05:03 +11:00
ckolivas 2a8cad1a28 Check for any unusual entries in get_fileinfo and abort. 2011-03-08 11:43:56 +11:00
ckolivas 9499a7b453 STDOUT does not affect the compression window in master branch. 2011-03-08 08:24:05 +11:00
Con Kolivas ef15ea28a8 Display outputting message only if not testing. 2011-03-07 21:18:15 +11:00
Con Kolivas 44ed5727b3 Clean up and fix times displayed.
Merge fixes.
2011-03-07 21:05:20 +11:00
ckolivas c6199980f0 Disable file checking when not possible or meaningful. 2011-03-07 20:53:59 +11:00
Con Kolivas 10b1201f82 Fix more of the dodgy merge. 2011-03-07 17:28:50 +11:00
Con Kolivas 9fc551c159 Merge branch 'temp'
Conflicts:
	main.c
2011-03-07 17:25:10 +11:00
Con Kolivas 13a6fb5b43 Dump the temporary file generated to emulate stdout at the end of each chunk on decompression and then truncate the file instead of writing the whole file before dumping it. 2011-03-07 17:14:07 +11:00
Con Kolivas 8a4df9774f Forgot two instances of temporary outfiles that need to be unlinked. 2011-03-07 13:44:29 +11:00
Con Kolivas 68469c2b6f Don't dump output to stdout when testing. 2011-03-07 13:41:00 +11:00
Con Kolivas 06fd0a3528 Unlink files in safe places. 2011-03-07 13:40:43 +11:00
Con Kolivas f9046e6756 Check free space after reading magic, and not when decompressing to stdout. 2011-03-07 13:36:03 +11:00
Con Kolivas 8fa01248e7 Unlink temporary files immediately to avoid files lying around in cases of unexpected/uncaught failure. 2011-03-07 13:33: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 e42916e51f Revert "Make sure to realloc filenames when making physical temp files to not have memory leaks."
This reverts commit 9c3d492524.

Oops, dirty commit.
2011-03-07 13:08:40 +11:00
Con Kolivas 8a4814081b Must read magic before testing free space.
Resolve conflict.
2011-03-07 13:06:30 +11:00
ckolivas d1dc3dd6b1 Don't bother zeroing variables that are already zeroed by memset. 2011-03-07 13:04:01 +11:00
Con Kolivas 9c3d492524 Make sure to realloc filenames when making physical temp files to not have memory leaks.
Fix conflict in merge.
2011-03-07 13:02:17 +11:00
ckolivas 81500282cc Move verbose summary till after we know if we have STDIN and STDOUT to more accurately reflect the window chosen. 2011-03-07 12:57:53 +11:00
Con Kolivas 96efe033fd Ignore what stdout is going to when testing from stdin. 2011-03-07 12:56:10 +11:00
Con Kolivas 624de254ce Revert "Fallocate space in advance on decompression."
This reverts commit cf03cb0c04.

Fallocating for some reason fails to write the end of the file! Revert change pending further investigation.
2011-02-28 22:13:36 +11:00
Con Kolivas 9e548448d6 Checked for the wrong standard. 2011-02-28 21:18:53 +11:00
Con Kolivas cf03cb0c04 Fallocate space in advance on decompression.
This often can speed up decompression of large files and decreases fragmentation.
2011-02-26 23:26:00 +11:00
Con Kolivas fd5a77ac21 Check on the fd_out on decompression, NOT on fd_in. 2011-02-26 23:19:50 +11:00
Con Kolivas 8bdd5688c8 Check for free space before compression/decompression and abort if -f option is not enabled. 2011-02-26 23:10:28 +11:00
ckolivas 9b60d6e703 Update manpage to new, cleaner help format. 2011-02-25 10:55:27 +11:00
ckolivas 3a818196cc Perform sanity testing on file information output which detects corrupted archives. 2011-02-25 09:31:35 +11:00
Con Kolivas 573aa534ac Display the offset of each block in verbose information as well. 2011-02-25 09:21:30 +11:00
Con Kolivas d90f670fbd The output from information is confusing on 32 bit when it cuts the available ram for internal use.
Display the actual amount of ram detected, and then decrease the value for calculating what the calculated window will be.
Move the variables to where they're only used locally.
2011-02-23 23:58:50 +11:00
Con Kolivas 48e7e31dad Make sure to not delete files that already exist and we've refused to overwrite! 2011-02-23 15:01:43 +11:00
Con Kolivas 9fef6ab803 Add verbose and max verbose modes for -i information.
This will give a breakdown of each rzip chunk and compressed block by jumping to each head offset and reading the header information.
2011-02-23 12:59:59 +11:00
Con Kolivas 8edc4bd052 Trivial 2011-02-23 01:29:17 +11:00
Con Kolivas 32ff6edf9a Only set the main process nice value to less when a back-end compression is enabled. 2011-02-23 01:26:51 +11:00
Con Kolivas e79127ace8 Trivial changes. 2011-02-23 01:22:54 +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 9c8b1ee795 Deprecate the -M option as it is no longer of any significant utility compared to the -U option. 2011-02-22 20:38:39 +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 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 5c80a0957d Add usage() to failure to read stdin/out. 2011-02-21 13:29:45 +11:00
Con Kolivas b06287cce5 Make it not read stdin from a terminal or write stdout to a terminal unless forced with -f. 2011-02-21 13:26:51 +11:00
Con Kolivas 29dfb16c7a Clean up the messy help output. 2011-02-21 12:49:44 +11:00
Con Kolivas a85b17a463 Minor help change. 2011-02-21 12:06:49 +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 d4fb4d025b Update manpage. 2011-02-20 23:22:45 +11:00
Con Kolivas 57e25da244 Update copyright yeah in updated files. 2011-02-20 23:04:44 +11:00
Con Kolivas c9863e0e60 Change default behaviour to deleting broken or damaged files that occur by interrupting lrzip or that fail integrity testing.
Implement the -k option to optionally keep broken or damaged files.
2011-02-20 23:02:15 +11:00
Con Kolivas 9b264959f5 Implement the ability to test the integrity of the file written to disk on decompression. 2011-02-20 22:29:49 +11:00
Con Kolivas 8a27dc5057 Changes to make md5 be used for integrity testing.
Add the md5 value to the end of each archive.
This can then be used for integrity testing instead of crc32.
Keep crc in new archives to maintain compatibility with version 0.5 files.
Use md5 integrity testing on decompression when available in preference, and disable calculation of crc32.
Display the choice of integrity testing in verbose output and when -i is used.
Display the md5 and crc values when max verbosity, file info, or display hash is enabled.
Store a new flag in the magic header to show that the md5 value is stored at the end of the file.
Update the magic header information document.
2011-02-20 18:01:19 +11:00
Con Kolivas 44a279579e Add option to display hash information without enabling verbose mode. 2011-02-20 12:20:05 +11:00
Con Kolivas c2417877bc Being implementing md5 hash checking by importing the md5 code from coreutils.
Implement md5 hash checking on compression by doing the md5 hash check as each sb low buffer has been allocated to avoid going over the file again where possible.
2011-02-18 09:09:40 +11:00
Con Kolivas 9c2b86fec6 We are flushing the wrong file on decompression. Make sure we flush the file out. 2011-02-08 08:27:22 +11:00
Con Kolivas 2cabb335cb Update copyright notices courtesy of Jari Aalto. 2010-12-16 09:45:21 +11:00
Con Kolivas db95eba695 Take into account VM split on 32 bits again. 2010-12-03 19:30:27 +11:00
Con Kolivas 6f2b94be3b Fix the case where a compressed file has more than one stream 0 entry per block.
Limit lzma windows to 300MB in the right place on 32 bit only.
Make the main process less nice than the backend threads since it tends to be the rate limiting step.
2010-11-24 20:12:19 +11:00
Con Kolivas 0a4f6807e5 Increase version number to 0.540.
Fix compression type reporting on -i.
Remove some unnecessary output when -i is used.
Update docs and benchmarks.
2010-11-16 23:14:35 +11:00
Con Kolivas 3e77c702bb Fix typo and manpage format.
Fix warnings on newer gcc with attribute unused.
2010-11-15 11:35:37 +11:00
Con Kolivas 1637598c3f Bump version number up to 0.530.
Update all documentation.
Minor fixes by Jari Aalto for build and docs.
2010-11-13 21:37:17 +11:00
Con Kolivas 6e4fdc97f8 Implement -p option to specify number of processors to determine thread count.
Remove -P option as failing to set permissions only issues a warning now, removing any requirement for -P.
Change default compression level back to 7 as 9 was not giving significantly better compression but was slowing things down.
2010-11-13 17:36:21 +11:00
Con Kolivas 5505097b2f Implement multithreaded back end compression by splitting up the compression stream into multiple threads, dependant on the number of CPUs detected.
This facilitates a massive speed up on SMP machines proportional to the number of CPUs during the back end compression phase, but does so at some cost to the final size.
Limit the number of threads to ensure that each thread at least works on a window of STREAM_BUFSIZE.
Disable the lzma threading library as it does not contribute any more to the scalability of this new approach, yet compromises compression.
Increase the size of the windows passed to all the compression back end types now as they need more to split them up into multiple threads, and the number of blocks increases the compressed size slightly.
2010-11-10 20:56:17 +11:00
Con Kolivas b469e7b56c Distros don't like 3 point versioning scheme so change back to 2 point and change version to 0.520. 2010-11-08 10:43:05 +11:00
Con Kolivas b8528abee9 Consciously check page size, even though no one's going to build this on a machine with a different page size.
Clean up builds, removing ifdefs from main code.
Make output choices consistent.
2010-11-06 18:17:33 +11:00
Con Kolivas d053898b71 Left out a ; on the Darwin builds in main.c 2010-11-06 09:11:14 +11:00
Con Kolivas c9cfd30eb5 Not 100x slower any more. Update docs. 2010-11-06 00:10:57 +11:00
Con Kolivas 5ea38c0e44 Ensure file size is correct on compressed file from stdin.
Improve visual output.
Update manpage.
2010-11-06 00:00:44 +11:00
Con Kolivas 017ec9e85a Move the ram allocation phase into rzip_fd to be able to get a more accurate measure of percentage done.
Prevent failure when offset is not a multiple of page size.
Add chunk percentage complete to output.
Tweak output at various verbosities.
Update documentation to reflect improved performance of unlimited mode.
Update benchmark results.
More tidying.
2010-11-05 23:02:58 +11:00
Con Kolivas a66dafe66a Updated benchmark results.
More tidying up.
2010-11-05 14:52:14 +11:00
Con Kolivas 296534921a Unlimited mode is now usable in a meaningful timeframe!
Modify the sliding mmap window to have a 64k smaller buffer which matches the size of the search size, and change the larger lower buffer to make it slide with the main hash search progress. This makes for a MUCH faster unlimited mode, making it actually usable.
Limit windows to 2GB again on 32 bit, but do it when determining the largest size possible in rzip.c.
Implement a linux-kernel like unlikely() wrapper for inbuilt expect, and modify most fatal warnings to be unlikely, and a few places where it's also suitable.
Minor cleanups.
2010-11-05 12:16:43 +11:00
Con Kolivas f422e93232 Update benchmarks.
Minor tweaks to output.
2010-11-05 00:16:18 +11:00
Con Kolivas 29b166629a Huge rewrite of buffer reading in rzip.c. We use a wrapper instead of
accessing the buffer directly, thus allowing us to have window sizes larger than
available ram. This is implemented through the use of a "sliding mmap"
implementation. Sliding mmap uses two mmapped buffers, one large one as
previously, and one page sized smaller one. When an attempt is made to read
beyond the end of the large buffer, the small buffer is remapped to the file
area that's being accessed. While this implementation is 100x slower than direct
mmapping, it allows us to implement unlimited sized compression windows.
Implement the -U option with unlimited sized windows.
Rework the selection of compression windows. Instead of trying to guess how
much ram the machine might be able to access, we try to safely buffer as much
ram as we can, and then use that to determine the file buffer size. Do not
choose an arbitrary upper window limit unless -w is specified.
Rework the -M option to try to buffer the entire file, reducing the buffer
size until we succeed.
Align buffer sizes to page size.
Clean up lots of unneeded variables.
Fix lots of minor logic issues to do with window sizes accepted/passed to rzip
and the compression backends.
More error handling.
Change -L to affect rzip compression level directly as well as backend
compression level and use 9 by default now.
More cleanups of information output.
Use 3 point release numbering in case one minor version has many subversions.
Numerous minor cleanups and tidying.
Updated docs and manpages.
2010-11-04 21:14:55 +11:00
Con Kolivas 9c00229ee1 Fix fd_hist check occurring too early on decompress.
fsync after flushing buffer.
Remove unnecessary memset after anonymous mmap.
Do test malloc before compression backend to see how big a chunk can be passed.
2010-11-02 13:50:15 +11:00
Con Kolivas c0ac813f6d Update docs.
Bump version number.
Tidy.
2010-11-02 11:14:00 +11:00
Con Kolivas 102140dc2b Reinstate the temporary files for decompression to stdout and testing as the damaged line reinstated last commit meant it looked like those combinations worked when they actually didn't.
Compression from stdin still works without temporary files.
2010-11-02 10:52:21 +11:00
Con Kolivas 772fbf602e Reinstitute 2GB window limit on 32 bit. It still doesn't work. However we can now decompress larger windows.
Do more mmap in place of malloc.
Update docs.
Remove redundant code.
2010-11-01 22:55:59 +11:00
Con Kolivas 0e09c9ec24 Reinstate the temporary file for decompression from stdin. Seeking makes that option broken without the temporary file.
Start documenting the new features in this version.
Minor tidying.
2010-11-01 21:37:55 +11:00
Con Kolivas ba1bf30d78 Minor tidying. 2010-11-01 19:59:27 +11:00
Con Kolivas 232b268367 Fix file size recording in the magic header when stdin is used. 2010-11-01 19:18:20 +11:00
Con Kolivas 43dd72b9e1 Do real stdin without the stupid temporary files by mmapping into anonymous ram. 2010-11-01 16:45:48 +11:00
Con Kolivas cb27097cb4 A few more cleanups to avoid using temporary files for stdout and testing on decompression. 2010-11-01 12:50:20 +11:00
Con Kolivas 3a22eb09b3 Fix output to work correctly to screen when stdout is selected.
Make stdout write directly to stdout on decompression without the need for temporary files since there is no need to seek backwards.
Make file testing not actually write the file during test.
More tidying up.
2010-11-01 11:18:58 +11:00
Con Kolivas a9ad1aef0e Start cleaning up all the flag testing with neat macros. 2010-11-01 04:53:53 +11:00
Con Kolivas 2bacbc60d2 We were attempting to truncate mmap to page size when only the offset needed to be.
Fix the longstanding limit on 32 bits that allowed us to allocate only 2GB of ram by moving the big malloc calls to mmap equivalents which allow us to mmap up to 2^44 bytes of anonymous space.
Use progressively smaller preallocation to try and defragment ram prior to real mmap call to increase success rate of allocating ram when it's a significant proportion of total ram.
Don't fail if preallocation is unsuccessful.
Add more detailed error reporting.
Minor cleanups.
2010-11-01 00:19:39 +11:00
Con Kolivas 25705aec28 Minor tidying. 2010-10-31 15:17:04 +11:00
Con Kolivas 8d9b64e1ec Change byte width to be dependant on file size.
This will increase speed of compression and generate a smaller file, but not be backward compatible.
Tweak the way memory is allocated to optimise chances of success and minimise slowdown for the machine.
fsync to empty dirty data before allocating large ram to increase chance of mem allocation and decrease disk thrash of write vs read.
Add lots more information to verbose mode.
Lots of code tidying and minor tweaks.
2010-10-31 15:09:05 +11:00
Con Kolivas de262bad2a Revert "Put tempfiles in /tmp rather than current directory."
This reverts commit 603785f783.

Not everyone has a large /tmp directory and may not be able to fit the temporary files in /tmp so it's not a great idea to do this by default.
2010-05-22 09:10:25 +10:00
Ed Avis b4dd8cdaa1 Also suppress final [OK] message with -q flag. 2010-05-21 15:40:33 +01:00
Ed Avis 603785f783 Put tempfiles in /tmp rather than current directory. 2010-05-19 14:35:39 +01:00
Ed Avis 025b4507c9 mkstemp returns -1 on failure. 2010-05-19 14:31:11 +01:00
Con Kolivas d972496aa8 Make messages come via stdout instead of stderror courtesy of Alexander Saprykin 2010-04-25 16:26:00 +10:00
Con Kolivas 6dcceb0b1b Initial import 2010-03-29 10:07:08 +11:00