Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm / boot / compressed / decompress.c
bloba2ac3fe7dbf8ab4e355e0ce43147d0fd689d6ebe
1 // SPDX-License-Identifier: GPL-2.0
2 #define _LINUX_STRING_H_
4 #include <linux/compiler.h> /* for inline */
5 #include <linux/types.h> /* for size_t */
6 #include <linux/stddef.h> /* for NULL */
7 #include <linux/linkage.h>
8 #include <asm/string.h>
10 extern unsigned long free_mem_ptr;
11 extern unsigned long free_mem_end_ptr;
12 extern void error(char *);
14 #define STATIC static
15 #define STATIC_RW_DATA /* non-static please */
17 /* Diagnostic functions */
18 #ifdef DEBUG
19 # define Assert(cond,msg) {if(!(cond)) error(msg);}
20 # define Trace(x) fprintf x
21 # define Tracev(x) {if (verbose) fprintf x ;}
22 # define Tracevv(x) {if (verbose>1) fprintf x ;}
23 # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
24 # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
25 #else
26 # define Assert(cond,msg)
27 # define Trace(x)
28 # define Tracev(x)
29 # define Tracevv(x)
30 # define Tracec(c,x)
31 # define Tracecv(c,x)
32 #endif
34 /* Not needed, but used in some headers pulled in by decompressors */
35 extern char * strstr(const char * s1, const char *s2);
36 extern size_t strlen(const char *s);
37 extern int memcmp(const void *cs, const void *ct, size_t count);
39 #ifdef CONFIG_KERNEL_GZIP
40 #include "../../../../lib/decompress_inflate.c"
41 #endif
43 #ifdef CONFIG_KERNEL_LZO
44 #include "../../../../lib/decompress_unlzo.c"
45 #endif
47 #ifdef CONFIG_KERNEL_LZMA
48 #include "../../../../lib/decompress_unlzma.c"
49 #endif
51 #ifdef CONFIG_KERNEL_XZ
52 #define memmove memmove
53 #define memcpy memcpy
54 #include "../../../../lib/decompress_unxz.c"
55 #endif
57 #ifdef CONFIG_KERNEL_LZ4
58 #include "../../../../lib/decompress_unlz4.c"
59 #endif
61 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
63 return __decompress(input, len, NULL, NULL, output, 0, NULL, error);