Root/
1 | #ifndef __LZ4_H__ |
2 | #define __LZ4_H__ |
3 | /* |
4 | * LZ4 Kernel Interface |
5 | * |
6 | * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com> |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. |
11 | */ |
12 | #define LZ4_MEM_COMPRESS (4096 * sizeof(unsigned char *)) |
13 | #define LZ4HC_MEM_COMPRESS (65538 * sizeof(unsigned char *)) |
14 | |
15 | /* |
16 | * lz4_compressbound() |
17 | * Provides the maximum size that LZ4 may output in a "worst case" scenario |
18 | * (input data not compressible) |
19 | */ |
20 | static inline size_t lz4_compressbound(size_t isize) |
21 | { |
22 | return isize + (isize / 255) + 16; |
23 | } |
24 | |
25 | /* |
26 | * lz4_compress() |
27 | * src : source address of the original data |
28 | * src_len : size of the original data |
29 | * dst : output buffer address of the compressed data |
30 | * This requires 'dst' of size LZ4_COMPRESSBOUND. |
31 | * dst_len : is the output size, which is returned after compress done |
32 | * workmem : address of the working memory. |
33 | * This requires 'workmem' of size LZ4_MEM_COMPRESS. |
34 | * return : Success if return 0 |
35 | * Error if return (< 0) |
36 | * note : Destination buffer and workmem must be already allocated with |
37 | * the defined size. |
38 | */ |
39 | int lz4_compress(const unsigned char *src, size_t src_len, |
40 | unsigned char *dst, size_t *dst_len, void *wrkmem); |
41 | |
42 | /* |
43 | * lz4hc_compress() |
44 | * src : source address of the original data |
45 | * src_len : size of the original data |
46 | * dst : output buffer address of the compressed data |
47 | * This requires 'dst' of size LZ4_COMPRESSBOUND. |
48 | * dst_len : is the output size, which is returned after compress done |
49 | * workmem : address of the working memory. |
50 | * This requires 'workmem' of size LZ4HC_MEM_COMPRESS. |
51 | * return : Success if return 0 |
52 | * Error if return (< 0) |
53 | * note : Destination buffer and workmem must be already allocated with |
54 | * the defined size. |
55 | */ |
56 | int lz4hc_compress(const unsigned char *src, size_t src_len, |
57 | unsigned char *dst, size_t *dst_len, void *wrkmem); |
58 | |
59 | /* |
60 | * lz4_decompress() |
61 | * src : source address of the compressed data |
62 | * src_len : is the input size, whcih is returned after decompress done |
63 | * dest : output buffer address of the decompressed data |
64 | * actual_dest_len: is the size of uncompressed data, supposing it's known |
65 | * return : Success if return 0 |
66 | * Error if return (< 0) |
67 | * note : Destination buffer must be already allocated. |
68 | * slightly faster than lz4_decompress_unknownoutputsize() |
69 | */ |
70 | int lz4_decompress(const char *src, size_t *src_len, char *dest, |
71 | size_t actual_dest_len); |
72 | |
73 | /* |
74 | * lz4_decompress_unknownoutputsize() |
75 | * src : source address of the compressed data |
76 | * src_len : is the input size, therefore the compressed size |
77 | * dest : output buffer address of the decompressed data |
78 | * dest_len: is the max size of the destination buffer, which is |
79 | * returned with actual size of decompressed data after |
80 | * decompress done |
81 | * return : Success if return 0 |
82 | * Error if return (< 0) |
83 | * note : Destination buffer must be already allocated. |
84 | */ |
85 | int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, |
86 | char *dest, size_t *dest_len); |
87 | #endif |
88 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9