Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #define _LINUX_STRING_H_
0003 
0004 #include <linux/compiler.h> /* for inline */
0005 #include <linux/types.h>    /* for size_t */
0006 #include <linux/stddef.h>   /* for NULL */
0007 #include <linux/linkage.h>
0008 #include <asm/string.h>
0009 #include "misc.h"
0010 
0011 #define STATIC static
0012 #define STATIC_RW_DATA  /* non-static please */
0013 
0014 /* Diagnostic functions */
0015 #ifdef DEBUG
0016 #  define Assert(cond,msg) {if(!(cond)) error(msg);}
0017 #  define Trace(x) fprintf x
0018 #  define Tracev(x) {if (verbose) fprintf x ;}
0019 #  define Tracevv(x) {if (verbose>1) fprintf x ;}
0020 #  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
0021 #  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
0022 #else
0023 #  define Assert(cond,msg)
0024 #  define Trace(x)
0025 #  define Tracev(x)
0026 #  define Tracevv(x)
0027 #  define Tracec(c,x)
0028 #  define Tracecv(c,x)
0029 #endif
0030 
0031 /* Not needed, but used in some headers pulled in by decompressors */
0032 extern char * strstr(const char * s1, const char *s2);
0033 extern size_t strlen(const char *s);
0034 extern int memcmp(const void *cs, const void *ct, size_t count);
0035 extern char * strchrnul(const char *, int);
0036 
0037 #ifdef CONFIG_KERNEL_GZIP
0038 #include "../../../../lib/decompress_inflate.c"
0039 #endif
0040 
0041 #ifdef CONFIG_KERNEL_LZO
0042 #include "../../../../lib/decompress_unlzo.c"
0043 #endif
0044 
0045 #ifdef CONFIG_KERNEL_LZMA
0046 #include "../../../../lib/decompress_unlzma.c"
0047 #endif
0048 
0049 #ifdef CONFIG_KERNEL_XZ
0050 /* Prevent KASAN override of string helpers in decompressor */
0051 #undef memmove
0052 #define memmove memmove
0053 #undef memcpy
0054 #define memcpy memcpy
0055 #include "../../../../lib/decompress_unxz.c"
0056 #endif
0057 
0058 #ifdef CONFIG_KERNEL_LZ4
0059 #include "../../../../lib/decompress_unlz4.c"
0060 #endif
0061 
0062 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
0063 {
0064     return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
0065 }