aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2009-08-06 18:09:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-08-07 13:39:56 -0400
commitdaeb6b6fbe27049f465c48a7d0ee5555c3b84064 (patch)
tree3a53744300e0083f3cbf8f769780d971234e3f8a /include
parent9c8a8228d0827e0d91d28527209988f672f97d28 (diff)
bzip2/lzma/gzip: fix comments describing decompressor API
Fix and improve comments in decompress/generic.h that describe the decompressor API. Also remove an unused definition, and rename INBUF_LEN in lib/decompress_inflate.c to conform to bzip2/lzma naming. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/decompress/generic.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
index 6dfb856327bb..0c7111a55a1a 100644
--- a/include/linux/decompress/generic.h
+++ b/include/linux/decompress/generic.h
@@ -1,31 +1,37 @@
1#ifndef DECOMPRESS_GENERIC_H 1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H 2#define DECOMPRESS_GENERIC_H
3 3
4/* Minimal chunksize to be read.
5 *Bzip2 prefers at least 4096
6 *Lzma prefers 0x10000 */
7#define COMPR_IOBUF_SIZE 4096
8
9typedef int (*decompress_fn) (unsigned char *inbuf, int len, 4typedef int (*decompress_fn) (unsigned char *inbuf, int len,
10 int(*fill)(void*, unsigned int), 5 int(*fill)(void*, unsigned int),
11 int(*writebb)(void*, unsigned int), 6 int(*flush)(void*, unsigned int),
12 unsigned char *output, 7 unsigned char *outbuf,
13 int *posp, 8 int *posp,
14 void(*error)(char *x)); 9 void(*error)(char *x));
15 10
16/* inbuf - input buffer 11/* inbuf - input buffer
17 *len - len of pre-read data in inbuf 12 *len - len of pre-read data in inbuf
18 *fill - function to fill inbuf if empty 13 *fill - function to fill inbuf when empty
19 *writebb - function to write out outbug 14 *flush - function to write out outbuf
15 *outbuf - output buffer
20 *posp - if non-null, input position (number of bytes read) will be 16 *posp - if non-null, input position (number of bytes read) will be
21 * returned here 17 * returned here
22 * 18 *
23 *If len != 0, the inbuf is initialized (with as much data), and fill 19 *If len != 0, inbuf should contain all the necessary input data, and fill
24 *should not be called 20 *should be NULL
25 *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE 21 *If len = 0, inbuf can be NULL, in which case the decompressor will allocate
26 *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE 22 *the input buffer. If inbuf != NULL it must be at least XXX_IOBUF_SIZE bytes.
23 *fill will be called (repeatedly...) to read data, at most XXX_IOBUF_SIZE
24 *bytes should be read per call. Replace XXX with the appropriate decompressor
25 *name, i.e. LZMA_IOBUF_SIZE.
26 *
27 *If flush = NULL, outbuf must be large enough to buffer all the expected
28 *output. If flush != NULL, the output buffer will be allocated by the
29 *decompressor (outbuf = NULL), and the flush function will be called to
30 *flush the output buffer at the appropriate time (decompressor and stream
31 *dependent).
27 */ 32 */
28 33
34
29/* Utility routine to detect the decompression method */ 35/* Utility routine to detect the decompression method */
30decompress_fn decompress_method(const unsigned char *inbuf, int len, 36decompress_fn decompress_method(const unsigned char *inbuf, int len,
31 const char **name); 37 const char **name);