Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef DECOMPRESS_GENERIC_H
0003 #define DECOMPRESS_GENERIC_H
0004 
0005 typedef int (*decompress_fn) (unsigned char *inbuf, long len,
0006                   long (*fill)(void*, unsigned long),
0007                   long (*flush)(void*, unsigned long),
0008                   unsigned char *outbuf,
0009                   long *posp,
0010                   void(*error)(char *x));
0011 
0012 /* inbuf   - input buffer
0013  *len     - len of pre-read data in inbuf
0014  *fill    - function to fill inbuf when empty
0015  *flush   - function to write out outbuf
0016  *outbuf  - output buffer
0017  *posp    - if non-null, input position (number of bytes read) will be
0018  *    returned here
0019  *
0020  *If len != 0, inbuf should contain all the necessary input data, and fill
0021  *should be NULL
0022  *If len = 0, inbuf can be NULL, in which case the decompressor will allocate
0023  *the input buffer.  If inbuf != NULL it must be at least XXX_IOBUF_SIZE bytes.
0024  *fill will be called (repeatedly...) to read data, at most XXX_IOBUF_SIZE
0025  *bytes should be read per call.  Replace XXX with the appropriate decompressor
0026  *name, i.e. LZMA_IOBUF_SIZE.
0027  *
0028  *If flush = NULL, outbuf must be large enough to buffer all the expected
0029  *output.  If flush != NULL, the output buffer will be allocated by the
0030  *decompressor (outbuf = NULL), and the flush function will be called to
0031  *flush the output buffer at the appropriate time (decompressor and stream
0032  *dependent).
0033  */
0034 
0035 
0036 /* Utility routine to detect the decompression method */
0037 decompress_fn decompress_method(const unsigned char *inbuf, long len,
0038                 const char **name);
0039 
0040 #endif