mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
9fec9f8ea5
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>
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
// SPDX-License-Identifier: Zlib
|
|
#ifndef DFLTCC_INFLATE_H
|
|
#define DFLTCC_INFLATE_H
|
|
|
|
#include "dfltcc.h"
|
|
|
|
/* External functions */
|
|
void dfltcc_reset_inflate_state(z_streamp strm);
|
|
int dfltcc_can_inflate(z_streamp strm);
|
|
typedef enum {
|
|
DFLTCC_INFLATE_CONTINUE,
|
|
DFLTCC_INFLATE_BREAK,
|
|
DFLTCC_INFLATE_SOFTWARE,
|
|
} dfltcc_inflate_action;
|
|
dfltcc_inflate_action dfltcc_inflate(z_streamp strm,
|
|
int flush, int *ret);
|
|
#define INFLATE_RESET_HOOK(strm) \
|
|
dfltcc_reset_inflate_state((strm))
|
|
|
|
#define INFLATE_TYPEDO_HOOK(strm, flush) \
|
|
if (dfltcc_can_inflate((strm))) { \
|
|
dfltcc_inflate_action action; \
|
|
\
|
|
RESTORE(); \
|
|
action = dfltcc_inflate((strm), (flush), &ret); \
|
|
LOAD(); \
|
|
if (action == DFLTCC_INFLATE_CONTINUE) \
|
|
break; \
|
|
else if (action == DFLTCC_INFLATE_BREAK) \
|
|
goto inf_leave; \
|
|
}
|
|
|
|
#define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm)))
|
|
|
|
#define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm)))
|
|
|
|
#endif /* DFLTCC_DEFLATE_H */
|