decompress.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #define _LINUX_STRING_H_
  2. #include <linux/compiler.h> /* for inline */
  3. #include <linux/types.h> /* for size_t */
  4. #include <linux/stddef.h> /* for NULL */
  5. #include <linux/linkage.h>
  6. #include <asm/string.h>
  7. extern unsigned long free_mem_ptr;
  8. extern unsigned long free_mem_end_ptr;
  9. extern void error(char *);
  10. #define STATIC static
  11. #define STATIC_RW_DATA /* non-static please */
  12. /* Diagnostic functions */
  13. #ifdef DEBUG
  14. # define Assert(cond,msg) {if(!(cond)) error(msg);}
  15. # define Trace(x) fprintf x
  16. # define Tracev(x) {if (verbose) fprintf x ;}
  17. # define Tracevv(x) {if (verbose>1) fprintf x ;}
  18. # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
  19. # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
  20. #else
  21. # define Assert(cond,msg)
  22. # define Trace(x)
  23. # define Tracev(x)
  24. # define Tracevv(x)
  25. # define Tracec(c,x)
  26. # define Tracecv(c,x)
  27. #endif
  28. /* Not needed, but used in some headers pulled in by decompressors */
  29. extern char * strstr(const char * s1, const char *s2);
  30. #ifdef CONFIG_KERNEL_GZIP
  31. #include "../../../../lib/decompress_inflate.c"
  32. #endif
  33. #ifdef CONFIG_KERNEL_LZO
  34. #include "../../../../lib/decompress_unlzo.c"
  35. #endif
  36. #ifdef CONFIG_KERNEL_LZMA
  37. #include "../../../../lib/decompress_unlzma.c"
  38. #endif
  39. #ifdef CONFIG_KERNEL_XZ
  40. #define memmove memmove
  41. #define memcpy memcpy
  42. #include "../../../../lib/decompress_unxz.c"
  43. #endif
  44. #ifdef CONFIG_KERNEL_LZ4
  45. #include "../../../../lib/decompress_unlz4.c"
  46. #endif
  47. int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
  48. {
  49. return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
  50. }