blob: 784ab33b7842384c6feae4f0318518a615f873eb [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* infutil.h -- types and macros common to blocks and codes
2 * Copyright (C) 1995-1998 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10
11#ifndef _INFUTIL_H
12#define _INFUTIL_H
13
Richard Purdie4f3865f2006-06-22 14:47:34 -070014#include <linux/zlib.h>
Mikhail Zaslonko12619612020-01-30 22:16:23 -080015#ifdef CONFIG_ZLIB_DFLTCC
16#include "../zlib_dfltcc/dfltcc.h"
17#include <asm/page.h>
18#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20/* memory allocation for inflation */
21
22struct inflate_workspace {
Richard Purdie4f3865f2006-06-22 14:47:34 -070023 struct inflate_state inflate_state;
Mikhail Zaslonko12619612020-01-30 22:16:23 -080024#ifdef CONFIG_ZLIB_DFLTCC
25 struct dfltcc_state dfltcc_state;
26 unsigned char working_window[(1 << MAX_WBITS) + PAGE_SIZE];
27#else
28 unsigned char working_window[(1 << MAX_WBITS)];
29#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070030};
31
Mikhail Zaslonko12619612020-01-30 22:16:23 -080032#ifdef CONFIG_ZLIB_DFLTCC
33/* dfltcc_state must be doubleword aligned for DFLTCC call */
34static_assert(offsetof(struct inflate_workspace, dfltcc_state) % 8 == 0);
35#endif
36
37#define WS(strm) ((struct inflate_workspace *)(strm->workspace))
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39#endif