summaryrefslogtreecommitdiff
path: root/lib/zlib_dfltcc/dfltcc.c
diff options
context:
space:
mode:
authorMikhail Zaslonko <zaslonko@linux.ibm.com>2023-01-26 14:14:26 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-02-02 22:50:09 -0800
commit9fec9f8ea51c782d58a8b86f8e868fc06c782386 (patch)
tree12df6a553a6eb2bdc0d61861462ae254eb6f44eb /lib/zlib_dfltcc/dfltcc.c
parentcbf125408d1ca141cc1c3f8376e091e3cdde2cb2 (diff)
lib/zlib: Split deflate and inflate states for DFLTCC
Currently deflate and inflate both use a common state struct. There are several variables in this struct that we don't need for inflate, and more may be coming in the future. Therefore split them in two separate structs. Apart from that, introduce separate headers for dfltcc_deflate and dfltcc_inflate. This commit is based on: https://github.com/zlib-ng/zlib-ng/commit/c592b1b Link: https://lkml.kernel.org/r/20230126131428.1222214-7-zaslonko@linux.ibm.com Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/zlib_dfltcc/dfltcc.c')
-rw-r--r--lib/zlib_dfltcc/dfltcc.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/lib/zlib_dfltcc/dfltcc.c b/lib/zlib_dfltcc/dfltcc.c
index 782f76e9d4da..ac6ac9739f5b 100644
--- a/lib/zlib_dfltcc/dfltcc.c
+++ b/lib/zlib_dfltcc/dfltcc.c
@@ -23,37 +23,18 @@ char *oesc_msg(
}
}
-void dfltcc_reset(
- z_streamp strm,
- uInt size
-)
-{
- struct dfltcc_state *dfltcc_state =
- (struct dfltcc_state *)((char *)strm->state + size);
- struct dfltcc_qaf_param *param =
- (struct dfltcc_qaf_param *)&dfltcc_state->param;
-
+void dfltcc_reset_state(struct dfltcc_state *dfltcc_state) {
/* Initialize available functions */
if (is_dfltcc_enabled()) {
- dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
- memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af));
+ dfltcc(DFLTCC_QAF, &dfltcc_state->param, NULL, NULL, NULL, NULL, NULL);
+ memmove(&dfltcc_state->af, &dfltcc_state->param, sizeof(dfltcc_state->af));
} else
memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
/* Initialize parameter block */
memset(&dfltcc_state->param, 0, sizeof(dfltcc_state->param));
dfltcc_state->param.nt = 1;
-
- /* Initialize tuning parameters */
- if (zlib_dfltcc_support == ZLIB_DFLTCC_FULL_DEBUG)
- dfltcc_state->level_mask = DFLTCC_LEVEL_MASK_DEBUG;
- else
- dfltcc_state->level_mask = DFLTCC_LEVEL_MASK;
- dfltcc_state->block_size = DFLTCC_BLOCK_SIZE;
- dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE;
- dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE;
dfltcc_state->param.ribm = DFLTCC_RIBM;
}
-EXPORT_SYMBOL(dfltcc_reset);
MODULE_LICENSE("GPL");