Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 1 | #define _LINUX_STRING_H_ |
| 2 | |
| 3 | #include <linux/compiler.h> /* for inline */ |
| 4 | #include <linux/types.h> /* for size_t */ |
| 5 | #include <linux/stddef.h> /* for NULL */ |
| 6 | #include <linux/linkage.h> |
| 7 | #include <asm/string.h> |
| 8 | |
| 9 | extern unsigned long free_mem_ptr; |
| 10 | extern unsigned long free_mem_end_ptr; |
| 11 | extern void error(char *); |
| 12 | |
| 13 | #define STATIC static |
Russell King | b89ebad | 2010-03-15 14:29:22 +0000 | [diff] [blame] | 14 | #define STATIC_RW_DATA /* non-static please */ |
Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 15 | |
Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 16 | /* Diagnostic functions */ |
| 17 | #ifdef DEBUG |
| 18 | # define Assert(cond,msg) {if(!(cond)) error(msg);} |
| 19 | # define Trace(x) fprintf x |
| 20 | # define Tracev(x) {if (verbose) fprintf x ;} |
| 21 | # define Tracevv(x) {if (verbose>1) fprintf x ;} |
| 22 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} |
| 23 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} |
| 24 | #else |
| 25 | # define Assert(cond,msg) |
| 26 | # define Trace(x) |
| 27 | # define Tracev(x) |
| 28 | # define Tracevv(x) |
| 29 | # define Tracec(c,x) |
| 30 | # define Tracecv(c,x) |
| 31 | #endif |
| 32 | |
Rob Herring | ef1c209 | 2012-08-15 16:28:36 +0100 | [diff] [blame] | 33 | /* Not needed, but used in some headers pulled in by decompressors */ |
| 34 | extern char * strstr(const char * s1, const char *s2); |
| 35 | |
Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 36 | #ifdef CONFIG_KERNEL_GZIP |
| 37 | #include "../../../../lib/decompress_inflate.c" |
| 38 | #endif |
| 39 | |
| 40 | #ifdef CONFIG_KERNEL_LZO |
| 41 | #include "../../../../lib/decompress_unlzo.c" |
| 42 | #endif |
| 43 | |
Albin Tonnerre | 6e8699f | 2010-04-03 11:40:28 +0100 | [diff] [blame] | 44 | #ifdef CONFIG_KERNEL_LZMA |
| 45 | #include "../../../../lib/decompress_unlzma.c" |
| 46 | #endif |
| 47 | |
Imre Kaloz | a7f464f | 2012-01-26 13:08:57 +0100 | [diff] [blame] | 48 | #ifdef CONFIG_KERNEL_XZ |
| 49 | #define memmove memmove |
| 50 | #define memcpy memcpy |
| 51 | #include "../../../../lib/decompress_unxz.c" |
| 52 | #endif |
| 53 | |
Kyungsik Lee | f9b493a | 2013-07-08 16:01:48 -0700 | [diff] [blame] | 54 | #ifdef CONFIG_KERNEL_LZ4 |
| 55 | #include "../../../../lib/decompress_unlz4.c" |
| 56 | #endif |
| 57 | |
Nicolas Pitre | ccc1c7c | 2011-04-21 21:59:49 -0400 | [diff] [blame] | 58 | int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) |
Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 59 | { |
Nicolas Pitre | ccc1c7c | 2011-04-21 21:59:49 -0400 | [diff] [blame] | 60 | return decompress(input, len, NULL, NULL, output, NULL, error); |
Russell King | 5de813b | 2010-02-25 12:14:40 +0000 | [diff] [blame] | 61 | } |