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>
12 #define STATIC_RW_DATA /* non-static please */
14 /* Diagnostic functions */
16 # define Assert(cond,msg) {if(!(cond)) error(msg);}
17 # define Trace(x) fprintf x
18 # define Tracev(x) {if (verbose) fprintf x ;}
19 # define Tracevv(x) {if (verbose>1) fprintf x ;}
20 # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
21 # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
23 # define Assert(cond,msg)
31 /* Not needed, but used in some headers pulled in by decompressors */
32 extern char * strstr(const char * s1, const char *s2);
33 extern size_t strlen(const char *s);
34 extern int strcmp(const char *cs, const char *ct);
35 extern int memcmp(const void *cs, const void *ct, size_t count);
36 extern char * strchrnul(const char *, int);
38 #ifdef CONFIG_KERNEL_GZIP
39 #include "../../../../lib/decompress_inflate.c"
42 #ifdef CONFIG_KERNEL_LZO
43 #include "../../../../lib/decompress_unlzo.c"
46 #ifdef CONFIG_KERNEL_LZMA
47 #include "../../../../lib/decompress_unlzma.c"
50 #ifdef CONFIG_KERNEL_XZ
51 /* Prevent KASAN override of string helpers in decompressor */
53 #define memmove memmove
56 #include "../../../../lib/decompress_unxz.c"
59 #ifdef CONFIG_KERNEL_LZ4
60 #include "../../../../lib/decompress_unlz4.c"
63 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
65 return __decompress(input, len, NULL, NULL, output, 0, NULL, error);