summaryrefslogtreecommitdiff
path: root/dfltcc.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: update copyright datesJim Meyering2023-01-011-1/+1
|
* maint: do not include stdbool.h, stdalign.hPaul Eggert2022-12-261-2/+0
| | | | | They are not needed in C23, which Gnulib now emulates. (We no longer worry about C89, since Gnulib doesn’t.)
* maint: port to gcc -std=c99 -Wstrict-prototypesPaul Eggert2022-12-251-1/+1
| | | | | | | | | | | | | This doesn’t fix any bugs, since the code is correct as-is on all C versions. However, it pacifies gcc -std=c99 -Wstrict-prototypes, which complains about a function definition without arguments unless there’s a previous prototype with ‘(void)’. Most (but not all) of this patch merely reverts some recent changes to be more consistent when porting to C23. * dfltcc.c (is_dfltcc_enabled): * gzip.c (get_input_size_and_time): * inflate.c (inflate_stored, inflate_fixed, inflate_dynamic): * unpack.c (read_byte):
* maint: port function definitions to C23Paul Eggert2022-12-251-2/+2
| | | | | | | C23 does not allow K&R style function definitions. Use protyped definitions. However, don't bother with (void) in function definitions since C23 prefers (); so prefer () to (void) as this will work with older compilers anyway.
* maint: make update-copyrightJim Meyering2022-01-031-1/+1
|
* maint: update all copyright year number rangesJim Meyering2021-01-011-1/+1
| | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise.
* Fix DFLTCC segfault when compressing or decompressing two filesIlya Leoshkevich2020-09-241-6/+8
| | | | | The value in total_in global variable from processing the first file affected processing of the second file. Fix by making total_in local.
* bug#43583: Fix building DFLTCC with clangIlya Leoshkevich2020-09-241-1/+6
| | | | clang does not support .machinemode, so put it under an #ifdef.
* IBM Z DFLTCC: add STREQ definitionIlya Leoshkevich2020-05-291-0/+2
| | | | | | | | Commit 81c9fe4d0986 replaced !strcmp with STREQ in order to be compliant with the gnulib linter, however, gnulib does not provide STREQ! Quite a few gnulib .c files contain private definitions of STREQ. This patch just goes with the flow and does the same in dfltcc.c.
* IBM Z DFLTCC: fix three data corruption issuesIlya Leoshkevich2020-01-101-23/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SUSE maintainers have found an issue related to building zlib in 31-bit mode, which also applies to gzip: STFLE instruction can be used only in z/Architecture mode: https://build.opensuse.org/request/show/708284 -- I have integrated the fix into this patch. * configure.ac (AC_CHECK_HEADERS_ONCE): Add feature detection for sys/sdt.h probes. * dfltcc.c (dfltcc_cc): Minor formatting improvements. (HB_BITS): Remove. (HB_SIZE): Likewise. (is_dfltcc_enabled): Fix buffer overrun on newer models and incomplete initialization on older models. Add machine mode hint. (dfltcc): Use sys/sdt.h feature detection. (bi_load): New function. (bi_close_block): Use bi_load. (close_stream): Fix overwriting the End-of-block Symbol. (dfltcc_deflate): Fix losing partial byte on flush. Fix setting Block-Continuation Flag when DFLTCC-CMPR outputs 0 bits and requests a retry. Minor formatting improvements. (dfltcc_inflate): Retry immediately if requested. Print the hardware error code and flush the output buffer on error. Minor formatting improvements. * tests/hufts: Ignore the hardware error code.
* maint: update all copyright year number rangesJim Meyering2020-01-011-1/+1
| | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise.
* maint: placate strcmp-vs-STREQ syntax check ruleJim Meyering2019-09-071-1/+1
| | | | | * dfltcc.c (is_dfltcc_enabled): Use STREQ (env, "0") in place of "!strcmp (env, "0").
* Improve IBM Z patchPaul Eggert2019-04-021-310/+322
| | | | | | | | | | | | | | | Most of this is minor changes to use GNU style and C99 constructs. * NEWS: Mention IBM Z. * bootstrap.conf (gnulib_modules): Add stdalign. * dfltcc.c: Include stdalign.h, stdbool.h. (union aligned_dfltcc_qaf_param, union aligned_dfltcc_param_v0): New types, used for C11-style alignment. All uses changed. (init_param): * gzip.c (BUFFER_ALIGNED): New macro. (inbuf, outbuf, window): Use it, so buffers are aligned everywhere. * gzip.h (INBUFSIZ, OUTBUFSIZE): Use big buffers everywhere, unless SMALL_MEM. * zip.c (SLOW, FAST): Now enums since they need not be macros:
* bug#34918: [PATCH] Add support for IBM Z hardware-accelerated deflateIlya Leoshkevich2019-04-021-0/+429
Future versions of IBM Z mainframes will provide DFLTCC instruction, which implements deflate algorithm in hardware with estimated compression and decompression performance orders of magnitude faster than the current gzip and ratio comparable with that of level 1. This patch adds DFLTCC support to gzip. In order to enable it, the following build commands should be used: $ ./configure --enable-dfltcc $ make When built like this, gzip would compress in hardware on level 1, and in software on all other levels. Decompression will always happen in hardware. In order to enable DFLTCC compression for levels 1-6 (i.e. to make it used by default) one could either add -DDFLTCC_LEVEL_MASK=0x7e at compile time, or set the environment variable DFLTCC_LEVEL_MASK to 0x7e at run time. Two DFLTCC compression calls produce the same results only when they both are made on machines of the same generation, and when the respective buffers have the same offset relative to the start of the page. Therefore care should be taken when using hardware compression when reproducible results are desired. One such use case - reproducible software builds - is handled explicitly: when SOURCE_DATE_EPOCH environment variable is set, the hardware compression is disabled. This patch tries to add DFLTCC support in a least intrusive way. All SystemZ-specific code was placed into a separate file, but unfortunately there is still a noticeable amount of changes in the main gzip code. Below is the summary of those changes. DFLTCC will refuse to write an End-of-block Symbol if there is no input data, thus in some cases it is necessary to do this manually. In order to achieve this, bi_buf and bi_valid were promoted to extern variables. lm_init() function moves the input buffer into the window, which is not desirable for DFLTCC. Therefore, its invocation was moved to software-only deflate(). In addition to initializing the window, this function also used to convert compression level to flags, which is still needed for DFLTCC. This responsibility was handed off to zip() function. To achieve maximum performance with DFLTCC, inbuf and outbuf must be 256k big and page-aligned. Additionally, for DFLTCC to work at all, the window must be page-aligned. In addition to compression, DFLTCC computes CRC-32 checksum, therefore, whenever it's used, software checksumming needs to be suppressed and its results replaced by those of dfltcc. This is achieved by introducing the new getcrc() and setcrc() functions. Unlike the current software implementation, DFLTCC decompresses data into the output buffer, and not the window. Therefore, just like flushing the window, flushing the output buffer must honor the test flag. Finally, znew-k test assumes that "znew -K" would not convert the test .Z file to .gz, which is not the case with DFLTCC. Since this is not the main point of the test, this assumption was relaxed.