Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xz.h
Go to the documentation of this file.
1 /*
2  * XZ decompressor
3  *
4  * Authors: Lasse Collin <[email protected]>
5  * Igor Pavlov <http://7-zip.org/>
6  *
7  * This file has been put into the public domain.
8  * You can do whatever you want with this file.
9  */
10 
11 #ifndef XZ_H
12 #define XZ_H
13 
14 #ifdef __KERNEL__
15 # include <linux/stddef.h>
16 # include <linux/types.h>
17 #else
18 # include <stddef.h>
19 # include <stdint.h>
20 #endif
21 
22 /* In Linux, this is used to make extern functions static when needed. */
23 #ifndef XZ_EXTERN
24 # define XZ_EXTERN extern
25 #endif
26 
52 enum xz_mode {
56 };
57 
108 enum xz_ret {
118 };
119 
136 struct xz_buf {
137  const uint8_t *in;
138  size_t in_pos;
139  size_t in_size;
140 
142  size_t out_pos;
143  size_t out_size;
144 };
145 
149 struct xz_dec;
150 
194 XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max);
195 
214 XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b);
215 
227 XZ_EXTERN void xz_dec_reset(struct xz_dec *s);
228 
234 XZ_EXTERN void xz_dec_end(struct xz_dec *s);
235 
236 /*
237  * Standalone build (userspace build or in-kernel build for boot time use)
238  * needs a CRC32 implementation. For normal in-kernel use, kernel's own
239  * CRC32 module is used instead, and users of this module don't need to
240  * care about the functions below.
241  */
242 #ifndef XZ_INTERNAL_CRC32
243 # ifdef __KERNEL__
244 # define XZ_INTERNAL_CRC32 0
245 # else
246 # define XZ_INTERNAL_CRC32 1
247 # endif
248 #endif
249 
250 #if XZ_INTERNAL_CRC32
251 /*
252  * This must be called before any other xz_* function to initialize
253  * the CRC32 lookup table.
254  */
255 XZ_EXTERN void xz_crc32_init(void);
256 
257 /*
258  * Update CRC32 value using the polynomial from IEEE-802.3. To start a new
259  * calculation, the third argument must be zero. To continue the calculation,
260  * the previously returned value is passed as the third argument.
261  */
263 #endif
264 #endif