X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Fdecompress_unlzma.c;h=0b954e04bd3015bb08332b2a30a13e1ff6414fea;hb=405d8f8b1d936414da2093d4149ff790ff3f84a5;hp=32123a1340e6bdb2125004def332daa5499c02f7;hpb=8d98f2246d7c622198ae0b8ca66f1c82b8a25377;p=linux-block.git diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 32123a1340e6..0b954e04bd30 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c @@ -29,12 +29,14 @@ *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef STATIC +#ifdef STATIC +#define PREBOOT +#else #include +#include #endif /* STATIC */ #include -#include #define MIN(a, b) (((a) < (b)) ? (a) : (b)) @@ -543,9 +545,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, int ret = -1; set_error_fn(error_fn); - if (!flush) - in_len -= 4; /* Uncompressed size hack active in pre-boot - environment */ + if (buf) inbuf = buf; else @@ -645,4 +645,15 @@ exit_0: return ret; } -#define decompress unlzma +#ifdef PREBOOT +STATIC int INIT decompress(unsigned char *buf, int in_len, + int(*fill)(void*, unsigned int), + int(*flush)(void*, unsigned int), + unsigned char *output, + int *posp, + void(*error_fn)(char *x) + ) +{ + return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); +} +#endif