Skip to content
Snippets Groups Projects
  1. Jan 27, 2025
  2. Dec 29, 2024
    • Yann Collet's avatar
      update type names · 04a2a021
      Yann Collet authored
      naming convention: Type names should start with a Capital letter (after the prefix)
      04a2a021
  3. Jun 14, 2024
  4. Nov 17, 2023
  5. Jun 15, 2023
  6. Mar 08, 2023
  7. Feb 12, 2023
  8. Feb 09, 2023
  9. Jan 20, 2023
  10. Jan 04, 2023
  11. Dec 20, 2022
    • Danielle Rozenblit's avatar
    • W. Felix Handte's avatar
      Coalesce Almost All Copyright Notices to Standard Phrasing · 5d693cc3
      W. Felix Handte authored
      ```
      for f in $(find . \( -path ./.git -o -path ./tests/fuzz/corpora -o -path ./tests/regression/data-cache -o -path ./tests/regression/cache \) -prune -o -type f); do sed -i '/Copyright .* \(Yann Collet\)\|\(Meta Platforms\)/ s/Copyright .*/Copyright (c) Meta Platforms, Inc. and affiliates./' $f; done
      
      git checkout HEAD -- build/VS2010/libzstd-dll/libzstd-dll.rc build/VS2010/zstd/zstd.rc tests/test-license.py contrib/linux-kernel/test/include/linux/xxhash.h examples/streaming_compression_thread_pool.c lib/legacy/zstd_v0*.c lib/legacy/zstd_v0*.h
      nano ./programs/windres/zstd.rc
      nano ./build/VS2010/zstd/zstd.rc
      nano ./build/VS2010/libzstd-dll/libzstd-dll.rc
      ```
      5d693cc3
    • W. Felix Handte's avatar
      Rewrite Copyright Date Ranges from `-present` to `-2022` · 7f12f24c
      W. Felix Handte authored
      Apparently it's better. Somehow.
      
      ```
      for f in $(find . \( -path ./.git -o -path ./tests/fuzz/corpora -o -path ./tests/regression/data-cache -o -path ./tests/regression/cache \) -prune -o -type f); do echo $f; sed -i 's/\-present/-2022/' $f; done
      
      g co HEAD -- build/meson/
      ```
      7f12f24c
    • W. Felix Handte's avatar
      Update Copyright Year ('2021' -> 'present') · 36d5c2f3
      W. Felix Handte authored
      ```
      for f in $(find . \( -path ./.git -o -path ./tests/fuzz/corpora -o -path ./tests/regression/data-cache -o -path ./tests/regression/cache \) -prune -o -type f);
      do
        sed -i 's/\-2021/-present/' $f;
      done
      
      g co HEAD -- .github/workflows/dev-short-tests.yml # fix bad match
      ```
      36d5c2f3
    • W. Felix Handte's avatar
      Update Copyright Headers 'Facebook' -> 'Meta Platforms' · 8927f985
      W. Felix Handte authored
      ```
      for f in $(find . \( -path ./.git -o -path ./tests/fuzz/corpora \) -prune -o -type f);
      do
        sed -i 's/Facebook, Inc\./Meta Platforms, Inc. and affiliates./' $f;
      done
      ```
      8927f985
  12. Dec 16, 2022
    • Nick Terrell's avatar
      [api][visibility] Make the visibility macros more consistent · 358a2374
      Nick Terrell authored
      1. Follow the scheme introduced in PR #2501 for both `zdict.h` and `zstd_errors.h`.
      2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that.
         Also make this change for `zstd.h`, since we probably shouldn't have changed
         that macro name without backward compatibility in the first place.
      3. Change all references to `*_VISIBILITY` to `*_VISIBLE`.
      
      Fixes #3359.
      358a2374
  13. Dec 15, 2022
    • Alex Xu (Hello71)'s avatar
      Use proper unaligned access attributes · a78c91ae
      Alex Xu (Hello71) authored
      Instead of using packed attribute hack, just use aligned attribute. It
      improves code generation on armv6 and armv7, and slightly improves code
      generation on aarch64. GCC generates identical code to regular aligned
      access on ARMv6 for all versions between 4.5 and trunk, except GCC 5
      which is buggy and generates the same (bad) code as packed access:
      https://gcc.godbolt.org/z/hq37rz7sb
      a78c91ae
  14. Dec 14, 2022
  15. Dec 13, 2022
  16. Oct 27, 2022
  17. Oct 22, 2022
  18. Oct 18, 2022
    • Miguel Ojeda's avatar
      [contrib][linux-kernel] Generate SPDX license identifiers (#3294) · 5c1cdba7
      Miguel Ojeda authored
      Add a `--spdx` option to the freestanding script to prefix
      files with a line like (for `.c` files):
      
          // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
      
      or (for `.h` and `.S` files):
      
          /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
      
      Given the style of the line to be used depends on the extension,
      a simple `sed` insert command would not work.
      
      It also skips the file if an existing SPDX line is there,
      as well as raising an error if an unexpected SPDX line appears
      anywhere else in the file, as well as for unexpected
      file extensions.
      
      I double-checked that all currently generated files appear
      to be license as expected with:
      
          grep -LRF 'This source code is licensed under both the BSD-style license (found in the'  linux/lib/zstd
          grep -LRF 'LICENSE file in the root directory of this source tree) and the GPLv2 (found' linux/lib/zstd
      
      but somebody knowledgable on the licensing of the project should
      double-check this is the intended case.
      
      Fixes: https://github.com/facebook/zstd/issues/3293
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
  19. Mar 10, 2022
  20. Mar 08, 2022
    • Cyber Knight's avatar
      [contrib][linux] Use ZSTD_CCtx_setPledgedSrcSize() instead of ZSTD_CCtx_reset() · 8ff20c25
      Cyber Knight authored
      
      - The previous patch throws the following warning:
      
       ../linux/lib/zstd/zstd_compress_module.c: In function ‘zstd_reset_cstream’:
      ../linux/lib/zstd/zstd_compress_module.c:136:34: error: enum conversion when passing argument 2 of ‘ZSTD_CCtx_reset’ is invalid in C++ [-Werror=c++-compat]
        136 |  return ZSTD_CCtx_reset(cstream, pledged_src_size);
            |                                  ^~~~~~~~~~~~~~~~
      In file included from ../linux/include/linux/zstd.h:26,
                       from ../linux/lib/zstd/zstd_compress_module.c:15:
      ../linux/include/linux/zstd_lib.h:501:20: note: expected ‘ZSTD_ResetDirective’ {aka ‘enum <anonymous>’} but argument is of type ‘long long unsigned int’
        501 | ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset);
            |                    ^~~~~~~~~~~~~~~
      cc1: all warnings being treated as errors
      
      Since we have a choice to either use ZSTD_CCtx_reset or ZSTD_CCtx_setPledgedSrcSize instead of ZSTD_resetCStream, let's switch to ZSTD_CCtx_setPledgedSrcSize to not have any unnecessary warns alongside the kernel build and CI test build.
      
      Signed-off-by: default avatarCyber Knight <cyberknight755@gmail.com>
  21. Mar 07, 2022
    • Cyber Knight's avatar
      [contrib][linux] Fix a warning in zstd_reset_cstream() · e470c940
      Cyber Knight authored
      
      - This fixes the below warning:
      
      ../lib/zstd/zstd_compress_module.c: In function 'zstd_reset_cstream':
      ../lib/zstd/zstd_compress_module.c:136:9: warning: 'ZSTD_resetCStream' is deprecated [-Wdeprecated-declarations]
        136 |         return ZSTD_resetCStream(cstream, pledged_src_size);
            |         ^~~~~~
      In file included from ../include/linux/zstd.h:26,
                       from ../lib/zstd/zstd_compress_module.c:15:
      ../include/linux/zstd_lib.h:2277:8: note: declared here
       2277 | size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
            |        ^~~~~~~~~~~~~~~~~
      
      ZSTD_resetCstream is deprecated and zstd_CCtx_reset is suggested to use hence let's switch to it.
      
      Signed-off-by: default avatarCyber Knight <cyberknight755@gmail.com>
      e470c940
  22. Jan 18, 2022
  23. Dec 14, 2021
  24. Dec 03, 2021
    • Nick Terrell's avatar
      [asm] Share portability macros and restrict ASM further · c2845694
      Nick Terrell authored
      Move portability macros to `lib/common/portability_macros.h`. This file
      only contains platform/feature detection (e.g. 0/1 macros). This file is
      shared between C and ASM code, so it cannot include any C code.
      
      Rename `HUF_` ASM macros to be `ZSTD_` prefixed, and move to the new
      header.
      
      Restrict `ZSTD_ASM_SUPPORTED` to `__GNUC__`, because we need the GAS
      assembler.
      
      Finally, only include the ASM code if we are actually going to use it.
      This disables it on all Windows platforms, which should resolve the
      problem brought up in Issue #2789.
      c2845694
  25. Nov 16, 2021
    • Nick Terrell's avatar
      [linux-kernel] Don't add -O3 to CFLAGS · e2d01863
      Nick Terrell authored
      It is no longer necessary to get good performance, there is only a small
      speed difference between -O2 and -O3, so just stick to the default of
      -O2. I've measured neutral compression speed and a ~3% decompression
      speed loss in userspace with clang & gcc. I've also measured neutral
      compression speed and a ~1% decompression speed loss in the kernel
      benchmarks.
      
      This also fixes the stack space usage on parisc. The compiler was buggy
      for -O3 and used ~3KB of stack space for several functions. With -O2 the
      problem is completely resolved, and stack space is back to a few hundred
      bytes.
      
      Additionally, we get a large code size win on gcc:
      
      | Compiler | Before (Bytes) | After (Bytes) | Delta (Bytes) |
      |----------|----------------|---------------|---------------|
      | gcc-11   |         952754 |        738954 |       -213800 |
      | clang-12 |         976290 |        938826 |        -37464 |
      e2d01863
    • Nick Terrell's avatar
      [linux-kernel] Don't inline function in zstd_opt.c · 19eb459d
      Nick Terrell authored
      The optimal parser is unlikely to be used in the linux kernel in
      practice. There is no reason these functions should be force inlined,
      since we aren't gaining anything, and are losing build size.
      
      | Compiler | Before (Bytes) | After (Bytes) | Delta (Bytes) |
      |----------|----------------|---------------|---------------|
      | gcc-11   |        1142090 |        952754 |       -189336 |
      | clang-12 |        1228402 |        976290 |       -252112 |
      
      This is a temporary solution pending the resolution of PR #2862 in the
      `dev` branch.
      19eb459d
  26. Sep 24, 2021
  27. Sep 23, 2021
    • Nick Terrell's avatar
      [lib] Make lib compatible with `-Wfall-through` excepting legacy · 189e87bc
      Nick Terrell authored
      Switch to a macro `ZSTD_FALLTHROUGH;` instead of a comment. On supported
      compilers this uses an attribute, otherwise it becomes a comment.
      
      This is necessary to be compatible with clang's `-Wfall-through`, and
      gcc's `-Wfall-through=2` which don't support comments. Without this the
      linux build emits a bunch of warnings.
      
      Also add a test to CI to ensure that we don't regress.
      189e87bc
    • Alexander Lobakin's avatar
      [contrib][linux] Add huf_decompress_amd64.o target to Makefile · c45b27ab
      Alexander Lobakin authored
      
      Commit a5f2c455 ("Huffman ASM") added a new ASM source file,
      but it wasn't added to the kernel Makefile despite that it received
      support for Huffman ASM according to the internal definitions. This
      leads to undefined references, as huf_decompress.o now calls those
      ASM functions.
      Add it to the list of sources when building inside the kernel tree.
      Kbuild can handle .S files just fine, so none additional rules
      needed.
      
      Fixes: a5f2c455 ("Huffman ASM")
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      c45b27ab
    • Alexander Lobakin's avatar
      [contrib][linux] Fix build with CONFIG_WERROR · e6d62bbf
      Alexander Lobakin authored
      
      Linux 5.15 introduces a new Kconfig option, CONFIG_WERROR, which
      forces -Werror for the entire kernel.
      Current in-kernel ZSTD implementation uses functions deprecated
      in 1.5.0, and thus fails on -Wdeprecated-declarations.
      Turn this particular error into warning to be able to build the
      kernel with CONFIG_WERROR. I'm not disabling them completely to
      make sure they'll be visible and [hopefully] fixed sooner or later.
      
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      e6d62bbf
    • senhuang42's avatar
      Move block splitter from stack to CCtx · 1d8143c8
      senhuang42 authored
      1d8143c8
    • Nick Terrell's avatar
      [contrib][linux] Reduce stack usage by 80 bytes · 162491f6
      Nick Terrell authored
      Instead of calling `ZSTD_compress_advanced()` and
      `ZSTD_initCStream_advanced()`, which each take a `ZSTD_parameters` by
      value, use the new advanced API.
      
      Stack usage went from 2024 -> 1944.
      162491f6
  28. Sep 22, 2021
  29. Sep 20, 2021
Loading