xref: /OK3568_Linux_fs/kernel/lib/zlib_inflate/infutil.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* infutil.h -- types and macros common to blocks and codes
2*4882a593Smuzhiyun  * Copyright (C) 1995-1998 Mark Adler
3*4882a593Smuzhiyun  * For conditions of distribution and use, see copyright notice in zlib.h
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun /* WARNING: this file should *not* be used by applications. It is
7*4882a593Smuzhiyun    part of the implementation of the compression library and is
8*4882a593Smuzhiyun    subject to change. Applications should only use zlib.h.
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef _INFUTIL_H
12*4882a593Smuzhiyun #define _INFUTIL_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/zlib.h>
15*4882a593Smuzhiyun #ifdef CONFIG_ZLIB_DFLTCC
16*4882a593Smuzhiyun #include "../zlib_dfltcc/dfltcc.h"
17*4882a593Smuzhiyun #include <asm/page.h>
18*4882a593Smuzhiyun #endif
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun /* memory allocation for inflation */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun struct inflate_workspace {
23*4882a593Smuzhiyun 	struct inflate_state inflate_state;
24*4882a593Smuzhiyun #ifdef CONFIG_ZLIB_DFLTCC
25*4882a593Smuzhiyun 	struct dfltcc_state dfltcc_state;
26*4882a593Smuzhiyun 	unsigned char working_window[(1 << MAX_WBITS) + PAGE_SIZE];
27*4882a593Smuzhiyun #else
28*4882a593Smuzhiyun 	unsigned char working_window[(1 << MAX_WBITS)];
29*4882a593Smuzhiyun #endif
30*4882a593Smuzhiyun };
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifdef CONFIG_ZLIB_DFLTCC
33*4882a593Smuzhiyun /* dfltcc_state must be doubleword aligned for DFLTCC call */
34*4882a593Smuzhiyun static_assert(offsetof(struct inflate_workspace, dfltcc_state) % 8 == 0);
35*4882a593Smuzhiyun #endif
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define WS(strm) ((struct inflate_workspace *)(strm->workspace))
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun #endif
40