/[packages]/backports/8/kernel/current/SOURCES/zstd-Move-zstd-common-module-exports-to-zstd_common_.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/zstd-Move-zstd-common-module-exports-to-zstd_common_.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1928606 - (show annotations) (download)
Sun Jan 1 13:13:06 2023 UTC (15 months, 3 weeks ago) by tmb
File size: 6168 byte(s)
sync with Cauldron kernel-6.1.2-1.mga9
1 From 4782c725c1538aa9ef894ae4a3938db40be7f02c Mon Sep 17 00:00:00 2001
2 From: Nick Terrell <terrelln@fb.com>
3 Date: Fri, 14 Oct 2022 14:47:04 -0700
4 Subject: [PATCH 5/6] zstd: Move zstd-common module exports to
5 zstd_common_module.c
6
7 The zstd codebase is imported from the upstream zstd repo, and is over-written on
8 every update. Upstream keeps the kernel specific code separate from the main
9 library. So the module definition is moved into the zstd_common_module.c file.
10 This matches the pattern followed by the zstd-compress and zstd-decompress files.
11
12 I've done build and boot testing on x86-64, i386, and aarch64. I've
13 verified that zstd built both as modules and built-in build and boot.
14
15 Signed-off-by: Nick Terrell <terrelln@fb.com>
16 ---
17 lib/zstd/Makefile | 1 +
18 lib/zstd/common/entropy_common.c | 4 ----
19 lib/zstd/common/zstd_common.c | 10 ----------
20 lib/zstd/zstd_common_module.c | 32 ++++++++++++++++++++++++++++++++
21 4 files changed, 33 insertions(+), 14 deletions(-)
22 create mode 100644 lib/zstd/zstd_common_module.c
23
24 diff --git a/lib/zstd/Makefile b/lib/zstd/Makefile
25 index 440bd0007ae2..20f08c644b71 100644
26 --- a/lib/zstd/Makefile
27 +++ b/lib/zstd/Makefile
28 @@ -35,6 +35,7 @@ zstd_decompress-y := \
29 decompress/zstd_decompress_block.o \
30
31 zstd_common-y := \
32 + zstd_common_module.o \
33 common/debug.o \
34 common/entropy_common.o \
35 common/error_private.o \
36 diff --git a/lib/zstd/common/entropy_common.c b/lib/zstd/common/entropy_common.c
37 index a311808c0d56..6353249de614 100644
38 --- a/lib/zstd/common/entropy_common.c
39 +++ b/lib/zstd/common/entropy_common.c
40 @@ -15,7 +15,6 @@
41 /* *************************************
42 * Dependencies
43 ***************************************/
44 -#include <linux/module.h>
45 #include "mem.h"
46 #include "error_private.h" /* ERR_*, ERROR */
47 #define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */
48 @@ -240,7 +239,6 @@ size_t FSE_readNCount(
49 {
50 return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0);
51 }
52 -EXPORT_SYMBOL_GPL(FSE_readNCount);
53
54 /*! HUF_readStats() :
55 Read compact Huffman tree, saved by HUF_writeCTable().
56 @@ -256,7 +254,6 @@ size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
57 U32 wksp[HUF_READ_STATS_WORKSPACE_SIZE_U32];
58 return HUF_readStats_wksp(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, wksp, sizeof(wksp), /* bmi2 */ 0);
59 }
60 -EXPORT_SYMBOL_GPL(HUF_readStats);
61
62 FORCE_INLINE_TEMPLATE size_t
63 HUF_readStats_body(BYTE* huffWeight, size_t hwSize, U32* rankStats,
64 @@ -357,4 +354,3 @@ size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, U32* rankStats,
65 (void)bmi2;
66 return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
67 }
68 -EXPORT_SYMBOL_GPL(HUF_readStats_wksp);
69 diff --git a/lib/zstd/common/zstd_common.c b/lib/zstd/common/zstd_common.c
70 index 0f1f63be25d9..3d7e35b309b5 100644
71 --- a/lib/zstd/common/zstd_common.c
72 +++ b/lib/zstd/common/zstd_common.c
73 @@ -13,7 +13,6 @@
74 /*-*************************************
75 * Dependencies
76 ***************************************/
77 -#include <linux/module.h>
78 #define ZSTD_DEPS_NEED_MALLOC
79 #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */
80 #include "error_private.h"
81 @@ -36,17 +35,14 @@ const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
82 * tells if a return value is an error code
83 * symbol is required for external callers */
84 unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
85 -EXPORT_SYMBOL_GPL(ZSTD_isError);
86
87 /*! ZSTD_getErrorName() :
88 * provides error code string from function result (useful for debugging) */
89 const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
90 -EXPORT_SYMBOL_GPL(ZSTD_getErrorName);
91
92 /*! ZSTD_getError() :
93 * convert a `size_t` function result into a proper ZSTD_errorCode enum */
94 ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
95 -EXPORT_SYMBOL_GPL(ZSTD_getErrorCode);
96
97 /*! ZSTD_getErrorString() :
98 * provides error code string from enum */
99 @@ -63,7 +59,6 @@ void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
100 return customMem.customAlloc(customMem.opaque, size);
101 return ZSTD_malloc(size);
102 }
103 -EXPORT_SYMBOL_GPL(ZSTD_customMalloc);
104
105 void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
106 {
107 @@ -76,7 +71,6 @@ void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
108 }
109 return ZSTD_calloc(1, size);
110 }
111 -EXPORT_SYMBOL_GPL(ZSTD_customCalloc);
112
113 void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
114 {
115 @@ -87,7 +81,3 @@ void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
116 ZSTD_free(ptr);
117 }
118 }
119 -EXPORT_SYMBOL_GPL(ZSTD_customFree);
120 -
121 -MODULE_LICENSE("Dual BSD/GPL");
122 -MODULE_DESCRIPTION("Zstd Common");
123 diff --git a/lib/zstd/zstd_common_module.c b/lib/zstd/zstd_common_module.c
124 new file mode 100644
125 index 000000000000..22686e367e6f
126 --- /dev/null
127 +++ b/lib/zstd/zstd_common_module.c
128 @@ -0,0 +1,32 @@
129 +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
130 +/*
131 + * Copyright (c) Facebook, Inc.
132 + * All rights reserved.
133 + *
134 + * This source code is licensed under both the BSD-style license (found in the
135 + * LICENSE file in the root directory of this source tree) and the GPLv2 (found
136 + * in the COPYING file in the root directory of this source tree).
137 + * You may select, at your option, one of the above-listed licenses.
138 + */
139 +
140 +#include <linux/module.h>
141 +
142 +#include "common/huf.h"
143 +#include "common/fse.h"
144 +#include "common/zstd_internal.h"
145 +
146 +// Export symbols shared by compress and decompress into a common module
147 +
148 +#undef ZSTD_isError /* defined within zstd_internal.h */
149 +EXPORT_SYMBOL_GPL(FSE_readNCount);
150 +EXPORT_SYMBOL_GPL(HUF_readStats);
151 +EXPORT_SYMBOL_GPL(HUF_readStats_wksp);
152 +EXPORT_SYMBOL_GPL(ZSTD_isError);
153 +EXPORT_SYMBOL_GPL(ZSTD_getErrorName);
154 +EXPORT_SYMBOL_GPL(ZSTD_getErrorCode);
155 +EXPORT_SYMBOL_GPL(ZSTD_customMalloc);
156 +EXPORT_SYMBOL_GPL(ZSTD_customCalloc);
157 +EXPORT_SYMBOL_GPL(ZSTD_customFree);
158 +
159 +MODULE_LICENSE("Dual BSD/GPL");
160 +MODULE_DESCRIPTION("Zstd Common");
161 --
162 2.30.6
163

  ViewVC Help
Powered by ViewVC 1.1.30