forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: zlib-ng/zlib-ng@c592b1b Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mikhail Zaslonko <[email protected]> Acked-by: Ilya Leoshkevich <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
- Loading branch information
Showing
8 changed files
with
110 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Zlib | ||
#ifndef DFLTCC_DEFLATE_H | ||
#define DFLTCC_DEFLATE_H | ||
|
||
#include "dfltcc.h" | ||
|
||
/* External functions */ | ||
int dfltcc_can_deflate(z_streamp strm); | ||
int dfltcc_deflate(z_streamp strm, | ||
int flush, | ||
block_state *result); | ||
void dfltcc_reset_deflate_state(z_streamp strm); | ||
|
||
#define DEFLATE_RESET_HOOK(strm) \ | ||
dfltcc_reset_deflate_state((strm)) | ||
|
||
#define DEFLATE_HOOK dfltcc_deflate | ||
|
||
#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm))) | ||
|
||
#endif /* DFLTCC_DEFLATE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters