Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/xxhash: remove more unused xxh functions

xxh32_reset() and xxh32_copy_state() are unused, and with those gone, the
xxh32_state struct is also unused.

xxh64_copy_state() is also unused.

Remove them all.

(Also fixes a comment above the xxh64_state that referred to it as
xxh32_state).

Link: https://lkml.kernel.org/r/20251024205120.454508-1-linux@treblig.org
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Dr. David Alan Gilbert and committed by
Andrew Morton
a0b8c6af 6c2e6e2c

+1 -74
+1 -45
include/linux/xxhash.h
··· 141 141 */ 142 142 143 143 /** 144 - * struct xxh32_state - private xxh32 state, do not use members directly 145 - */ 146 - struct xxh32_state { 147 - uint32_t total_len_32; 148 - uint32_t large_len; 149 - uint32_t v1; 150 - uint32_t v2; 151 - uint32_t v3; 152 - uint32_t v4; 153 - uint32_t mem32[4]; 154 - uint32_t memsize; 155 - }; 156 - 157 - /** 158 - * struct xxh32_state - private xxh64 state, do not use members directly 144 + * struct xxh64_state - private xxh64 state, do not use members directly 159 145 */ 160 146 struct xxh64_state { 161 147 uint64_t total_len; ··· 152 166 uint64_t mem64[4]; 153 167 uint32_t memsize; 154 168 }; 155 - 156 - /** 157 - * xxh32_reset() - reset the xxh32 state to start a new hashing operation 158 - * 159 - * @state: The xxh32 state to reset. 160 - * @seed: Initialize the hash state with this seed. 161 - * 162 - * Call this function on any xxh32_state to prepare for a new hashing operation. 163 - */ 164 - void xxh32_reset(struct xxh32_state *state, uint32_t seed); 165 169 166 170 /** 167 171 * xxh64_reset() - reset the xxh64 state to start a new hashing operation ··· 185 209 * Return: The xxh64 hash stored in the state. 186 210 */ 187 211 uint64_t xxh64_digest(const struct xxh64_state *state); 188 - 189 - /*-************************** 190 - * Utils 191 - ***************************/ 192 - 193 - /** 194 - * xxh32_copy_state() - copy the source state into the destination state 195 - * 196 - * @src: The source xxh32 state. 197 - * @dst: The destination xxh32 state. 198 - */ 199 - void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src); 200 - 201 - /** 202 - * xxh64_copy_state() - copy the source state into the destination state 203 - * 204 - * @src: The source xxh64 state. 205 - * @dst: The destination xxh64 state. 206 - */ 207 - void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src); 208 212 209 213 #endif /* XXHASH_H */
-29
lib/xxhash.c
··· 73 73 static const uint64_t PRIME64_4 = 9650029242287828579ULL; 74 74 static const uint64_t PRIME64_5 = 2870177450012600261ULL; 75 75 76 - /*-************************** 77 - * Utils 78 - ***************************/ 79 - void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src) 80 - { 81 - memcpy(dst, src, sizeof(*dst)); 82 - } 83 - EXPORT_SYMBOL(xxh32_copy_state); 84 - 85 - void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src) 86 - { 87 - memcpy(dst, src, sizeof(*dst)); 88 - } 89 - EXPORT_SYMBOL(xxh64_copy_state); 90 - 91 76 /*-*************************** 92 77 * Simple Hash Functions 93 78 ****************************/ ··· 224 239 /*-************************************************** 225 240 * Advanced Hash Functions 226 241 ***************************************************/ 227 - void xxh32_reset(struct xxh32_state *statePtr, const uint32_t seed) 228 - { 229 - /* use a local state for memcpy() to avoid strict-aliasing warnings */ 230 - struct xxh32_state state; 231 - 232 - memset(&state, 0, sizeof(state)); 233 - state.v1 = seed + PRIME32_1 + PRIME32_2; 234 - state.v2 = seed + PRIME32_2; 235 - state.v3 = seed + 0; 236 - state.v4 = seed - PRIME32_1; 237 - memcpy(statePtr, &state, sizeof(state)); 238 - } 239 - EXPORT_SYMBOL(xxh32_reset); 240 - 241 242 void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed) 242 243 { 243 244 /* use a local state for memcpy() to avoid strict-aliasing warnings */