Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LZO_H__
0003 #define __LZO_H__
0004 /*
0005  *  LZO Public Kernel Interface
0006  *  A mini subset of the LZO real-time data compression library
0007  *
0008  *  Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
0009  *
0010  *  The full LZO package can be found at:
0011  *  http://www.oberhumer.com/opensource/lzo/
0012  *
0013  *  Changed for Linux kernel use by:
0014  *  Nitin Gupta <nitingupta910@gmail.com>
0015  *  Richard Purdie <rpurdie@openedhand.com>
0016  */
0017 
0018 #define LZO1X_1_MEM_COMPRESS    (8192 * sizeof(unsigned short))
0019 #define LZO1X_MEM_COMPRESS  LZO1X_1_MEM_COMPRESS
0020 
0021 #define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3 + 2)
0022 
0023 /* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
0024 int lzo1x_1_compress(const unsigned char *src, size_t src_len,
0025              unsigned char *dst, size_t *dst_len, void *wrkmem);
0026 
0027 /* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
0028 int lzorle1x_1_compress(const unsigned char *src, size_t src_len,
0029              unsigned char *dst, size_t *dst_len, void *wrkmem);
0030 
0031 /* safe decompression with overrun testing */
0032 int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
0033               unsigned char *dst, size_t *dst_len);
0034 
0035 /*
0036  * Return values (< 0 = Error)
0037  */
0038 #define LZO_E_OK            0
0039 #define LZO_E_ERROR         (-1)
0040 #define LZO_E_OUT_OF_MEMORY     (-2)
0041 #define LZO_E_NOT_COMPRESSIBLE      (-3)
0042 #define LZO_E_INPUT_OVERRUN     (-4)
0043 #define LZO_E_OUTPUT_OVERRUN        (-5)
0044 #define LZO_E_LOOKBEHIND_OVERRUN    (-6)
0045 #define LZO_E_EOF_NOT_FOUND     (-7)
0046 #define LZO_E_INPUT_NOT_CONSUMED    (-8)
0047 #define LZO_E_NOT_YET_IMPLEMENTED   (-9)
0048 #define LZO_E_INVALID_ARGUMENT      (-10)
0049 
0050 #endif