]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
initramfs: support initramfs that is bigger than 2GiB
authorYinghai Lu <yinghai@kernel.org>
Fri, 8 Aug 2014 21:23:14 +0000 (14:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2014 22:57:26 +0000 (15:57 -0700)
Now with 64bit bzImage and kexec tools, we support ramdisk that size is
bigger than 2g, as we could put it above 4G.

Found compressed initramfs image could not be decompressed properly.  It
turns out that image length is int during decompress detection, and it
will become < 0 when length is more than 2G.  Furthermore, during
decompressing len as int is used for inbuf count, that has problem too.

Change len to long, that should be ok as on 32 bit platform long is
32bits.

Tested with following compressed initramfs image as root with kexec.
gzip, bzip2, xz, lzma, lzop, lz4.
run time for populate_rootfs():
   size        name       Nehalem-EX  Westmere-EX  Ivybridge-EX
 9034400256 root_img     :   26s           24s          30s
 3561095057 root_img.lz4 :   28s           27s          27s
 3459554629 root_img.lzo :   29s           29s          28s
 3219399480 root_img.gz  :   64s           62s          49s
 2251594592 root_img.xz  :  262s          260s         183s
 2226366598 root_img.lzma:  386s          376s         277s
 2901482513 root_img.bz2 :  635s          599s

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rashika Kheria <rashika.kheria@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: P J P <ppandit@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: "Daniel M. Weeks" <dan@danweeks.net>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
20 files changed:
crypto/zlib.c
fs/isofs/compress.c
fs/jffs2/compr_zlib.c
include/linux/decompress/bunzip2.h
include/linux/decompress/generic.h
include/linux/decompress/inflate.h
include/linux/decompress/unlz4.h
include/linux/decompress/unlzma.h
include/linux/decompress/unlzo.h
include/linux/decompress/unxz.h
include/linux/zlib.h
init/do_mounts_rd.c
init/initramfs.c
lib/decompress.c
lib/decompress_bunzip2.c
lib/decompress_inflate.c
lib/decompress_unlz4.c
lib/decompress_unlzma.c
lib/decompress_unlzo.c
lib/decompress_unxz.c

index 06b62e5cdcc72a93281051a7c07b5090be9abeaa..c9ee681d57fdf5dd6fb39081d4af3ad02be39d97 100644 (file)
@@ -168,7 +168,7 @@ static int zlib_compress_update(struct crypto_pcomp *tfm,
        }
 
        ret = req->avail_out - stream->avail_out;
-       pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
+       pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n",
                 stream->avail_in, stream->avail_out,
                 req->avail_in - stream->avail_in, ret);
        req->next_in = stream->next_in;
@@ -198,7 +198,7 @@ static int zlib_compress_final(struct crypto_pcomp *tfm,
        }
 
        ret = req->avail_out - stream->avail_out;
-       pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
+       pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n",
                 stream->avail_in, stream->avail_out,
                 req->avail_in - stream->avail_in, ret);
        req->next_in = stream->next_in;
@@ -283,7 +283,7 @@ static int zlib_decompress_update(struct crypto_pcomp *tfm,
        }
 
        ret = req->avail_out - stream->avail_out;
-       pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
+       pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n",
                 stream->avail_in, stream->avail_out,
                 req->avail_in - stream->avail_in, ret);
        req->next_in = stream->next_in;
@@ -331,7 +331,7 @@ static int zlib_decompress_final(struct crypto_pcomp *tfm,
        }
 
        ret = req->avail_out - stream->avail_out;
-       pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
+       pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n",
                 stream->avail_in, stream->avail_out,
                 req->avail_in - stream->avail_in, ret);
        req->next_in = stream->next_in;
index 592e5115a561bc8b736ae9ba90cdbddb8a628b30..f311bf084015fd1450a859ebb31e0200ccd20ff3 100644 (file)
@@ -158,8 +158,8 @@ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
                                               "zisofs: zisofs_inflate returned"
                                               " %d, inode = %lu,"
                                               " page idx = %d, bh idx = %d,"
-                                              " avail_in = %d,"
-                                              " avail_out = %d\n",
+                                              " avail_in = %ld,"
+                                              " avail_out = %ld\n",
                                               zerr, inode->i_ino, curpage,
                                               curbh, stream.avail_in,
                                               stream.avail_out);
index 0b9a1e44e833e691e2fc8dd2ca3135274113aad3..5698dae5d92dd5f7c3b8db3674348ae80fea45f0 100644 (file)
@@ -94,11 +94,12 @@ static int jffs2_zlib_compress(unsigned char *data_in,
 
        while (def_strm.total_out < *dstlen - STREAM_END_SPACE && def_strm.total_in < *sourcelen) {
                def_strm.avail_out = *dstlen - (def_strm.total_out + STREAM_END_SPACE);
-               def_strm.avail_in = min((unsigned)(*sourcelen-def_strm.total_in), def_strm.avail_out);
-               jffs2_dbg(1, "calling deflate with avail_in %d, avail_out %d\n",
+               def_strm.avail_in = min_t(unsigned long,
+                       (*sourcelen-def_strm.total_in), def_strm.avail_out);
+               jffs2_dbg(1, "calling deflate with avail_in %ld, avail_out %ld\n",
                          def_strm.avail_in, def_strm.avail_out);
                ret = zlib_deflate(&def_strm, Z_PARTIAL_FLUSH);
-               jffs2_dbg(1, "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n",
+               jffs2_dbg(1, "deflate returned with avail_in %ld, avail_out %ld, total_in %ld, total_out %ld\n",
                          def_strm.avail_in, def_strm.avail_out,
                          def_strm.total_in, def_strm.total_out);
                if (ret != Z_OK) {
index 115272137a9c8cb3e2b8f1d62dfb010999c97087..4d683df898e6eace4661926628982c70249a5276 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef DECOMPRESS_BUNZIP2_H
 #define DECOMPRESS_BUNZIP2_H
 
-int bunzip2(unsigned char *inbuf, int len,
-           int(*fill)(void*, unsigned int),
-           int(*flush)(void*, unsigned int),
+int bunzip2(unsigned char *inbuf, long len,
+           long (*fill)(void*, unsigned long),
+           long (*flush)(void*, unsigned long),
            unsigned char *output,
-           int *pos,
+           long *pos,
            void(*error)(char *x));
 #endif
index 0c7111a55a1aaf101dd5aefbef1f77036ed599d6..1fcfd64b5076eaa8a7830d840e098ce8b5fe9edc 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef DECOMPRESS_GENERIC_H
 #define DECOMPRESS_GENERIC_H
 
-typedef int (*decompress_fn) (unsigned char *inbuf, int len,
-                             int(*fill)(void*, unsigned int),
-                             int(*flush)(void*, unsigned int),
+typedef int (*decompress_fn) (unsigned char *inbuf, long len,
+                             long (*fill)(void*, unsigned long),
+                             long (*flush)(void*, unsigned long),
                              unsigned char *outbuf,
-                             int *posp,
+                             long *posp,
                              void(*error)(char *x));
 
 /* inbuf   - input buffer
@@ -33,7 +33,7 @@ typedef int (*decompress_fn) (unsigned char *inbuf, int len,
 
 
 /* Utility routine to detect the decompression method */
-decompress_fn decompress_method(const unsigned char *inbuf, int len,
+decompress_fn decompress_method(const unsigned char *inbuf, long len,
                                const char **name);
 
 #endif
index 1d0aedef982206fae64706263b35024b9373e6b8..e4f411fdbd24b2461959a454e98dc158344c1ec0 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef LINUX_DECOMPRESS_INFLATE_H
 #define LINUX_DECOMPRESS_INFLATE_H
 
-int gunzip(unsigned char *inbuf, int len,
-          int(*fill)(void*, unsigned int),
-          int(*flush)(void*, unsigned int),
+int gunzip(unsigned char *inbuf, long len,
+          long (*fill)(void*, unsigned long),
+          long (*flush)(void*, unsigned long),
           unsigned char *output,
-          int *pos,
+          long *pos,
           void(*error_fn)(char *x));
 #endif
index d5b68bf3ec92ae2c4c1d7db106e1a557b0daa344..3273c2f364961f7490684161818c4e6fa11d7f5e 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef DECOMPRESS_UNLZ4_H
 #define DECOMPRESS_UNLZ4_H
 
-int unlz4(unsigned char *inbuf, int len,
-       int(*fill)(void*, unsigned int),
-       int(*flush)(void*, unsigned int),
+int unlz4(unsigned char *inbuf, long len,
+       long (*fill)(void*, unsigned long),
+       long (*flush)(void*, unsigned long),
        unsigned char *output,
-       int *pos,
+       long *pos,
        void(*error)(char *x));
 #endif
index 7796538f1bf4262cc5682a167e63627ea08a727d..8a891a1938403c654e546cc2bcb3eb131259a51b 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef DECOMPRESS_UNLZMA_H
 #define DECOMPRESS_UNLZMA_H
 
-int unlzma(unsigned char *, int,
-          int(*fill)(void*, unsigned int),
-          int(*flush)(void*, unsigned int),
+int unlzma(unsigned char *, long,
+          long (*fill)(void*, unsigned long),
+          long (*flush)(void*, unsigned long),
           unsigned char *output,
-          int *posp,
+          long *posp,
           void(*error)(char *x)
        );
 
index 98722975251941deb1f25482d2277bc4640e8569..af18f95d65703e0b16594a288a01bb3a72c30a95 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef DECOMPRESS_UNLZO_H
 #define DECOMPRESS_UNLZO_H
 
-int unlzo(unsigned char *inbuf, int len,
-       int(*fill)(void*, unsigned int),
-       int(*flush)(void*, unsigned int),
+int unlzo(unsigned char *inbuf, long len,
+       long (*fill)(void*, unsigned long),
+       long (*flush)(void*, unsigned long),
        unsigned char *output,
-       int *pos,
+       long *pos,
        void(*error)(char *x));
 #endif
index 41728fc6c8a1add9efd3ae97cdb7ccf1c2b1df56..f764e2a7201e35ce7d725254afdbb28c8664bab5 100644 (file)
 #ifndef DECOMPRESS_UNXZ_H
 #define DECOMPRESS_UNXZ_H
 
-int unxz(unsigned char *in, int in_size,
-        int (*fill)(void *dest, unsigned int size),
-        int (*flush)(void *src, unsigned int size),
-        unsigned char *out, int *in_used,
+int unxz(unsigned char *in, long in_size,
+        long (*fill)(void *dest, unsigned long size),
+        long (*flush)(void *src, unsigned long size),
+        unsigned char *out, long *in_used,
         void (*error)(char *x));
 
 #endif
index 197abb2a54c5d713dd1a909da735bee60ab28d12..92dbbd3f6c757178d66b0b0e3d9f05789a05e02e 100644 (file)
@@ -83,11 +83,11 @@ struct internal_state;
 
 typedef struct z_stream_s {
     const Byte *next_in;   /* next input byte */
-    uInt     avail_in;  /* number of bytes available at next_in */
+       uLong avail_in;  /* number of bytes available at next_in */
     uLong    total_in;  /* total nb of input bytes read so far */
 
     Byte    *next_out;  /* next output byte should be put there */
-    uInt     avail_out; /* remaining free space at next_out */
+       uLong avail_out; /* remaining free space at next_out */
     uLong    total_out; /* total nb of bytes output so far */
 
     char     *msg;      /* last error message, NULL if no error */
index a8227022e3a02210afaab0cc628729f80ca07af8..e5d059e8aa11e78c736c75f452bc641abeec09b2 100644 (file)
@@ -311,9 +311,9 @@ static int exit_code;
 static int decompress_error;
 static int crd_infd, crd_outfd;
 
-static int __init compr_fill(void *buf, unsigned int len)
+static long __init compr_fill(void *buf, unsigned long len)
 {
-       int r = sys_read(crd_infd, buf, len);
+       long r = sys_read(crd_infd, buf, len);
        if (r < 0)
                printk(KERN_ERR "RAMDISK: error while reading compressed data");
        else if (r == 0)
@@ -321,13 +321,13 @@ static int __init compr_fill(void *buf, unsigned int len)
        return r;
 }
 
-static int __init compr_flush(void *window, unsigned int outcnt)
+static long __init compr_flush(void *window, unsigned long outcnt)
 {
-       int written = sys_write(crd_outfd, window, outcnt);
+       long written = sys_write(crd_outfd, window, outcnt);
        if (written != outcnt) {
                if (decompress_error == 0)
                        printk(KERN_ERR
-                              "RAMDISK: incomplete write (%d != %d)\n",
+                              "RAMDISK: incomplete write (%ld != %ld)\n",
                               written, outcnt);
                decompress_error = 1;
                return -1;
index 4f276b6a167b1ef518b98a7e68256f080b7f43ac..a7566031242e56cb0076174966c91a523fc253b6 100644 (file)
@@ -197,7 +197,7 @@ static __initdata enum state {
 } state, next_state;
 
 static __initdata char *victim;
-static __initdata unsigned count;
+static unsigned long count __initdata;
 static __initdata loff_t this_header, next_header;
 
 static inline void __init eat(unsigned n)
@@ -209,7 +209,7 @@ static inline void __init eat(unsigned n)
 
 static __initdata char *vcollected;
 static __initdata char *collected;
-static __initdata int remains;
+static long remains __initdata;
 static __initdata char *collect;
 
 static void __init read_into(char *buf, unsigned size, enum state next)
@@ -236,7 +236,7 @@ static int __init do_start(void)
 
 static int __init do_collect(void)
 {
-       unsigned n = remains;
+       unsigned long n = remains;
        if (count < n)
                n = count;
        memcpy(collect, victim, n);
@@ -407,7 +407,7 @@ static __initdata int (*actions[])(void) = {
        [Reset]         = do_reset,
 };
 
-static int __init write_buffer(char *buf, unsigned len)
+static long __init write_buffer(char *buf, unsigned long len)
 {
        count = len;
        victim = buf;
@@ -417,11 +417,11 @@ static int __init write_buffer(char *buf, unsigned len)
        return len - count;
 }
 
-static int __init flush_buffer(void *bufv, unsigned len)
+static long __init flush_buffer(void *bufv, unsigned long len)
 {
        char *buf = (char *) bufv;
-       int written;
-       int origLen = len;
+       long written;
+       long origLen = len;
        if (message)
                return -1;
        while ((written = write_buffer(buf, len)) < len && !message) {
@@ -440,13 +440,13 @@ static int __init flush_buffer(void *bufv, unsigned len)
        return origLen;
 }
 
-static unsigned my_inptr;   /* index of next byte to be processed in inbuf */
+static unsigned long my_inptr; /* index of next byte to be processed in inbuf */
 
 #include <linux/decompress/generic.h>
 
-static char * __init unpack_to_rootfs(char *buf, unsigned len)
+static char * __init unpack_to_rootfs(char *buf, unsigned long len)
 {
-       int written, res;
+       long written;
        decompress_fn decompress;
        const char *compress_name;
        static __initdata char msg_buf[64];
@@ -480,7 +480,7 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
                decompress = decompress_method(buf, len, &compress_name);
                pr_debug("Detected %s compressed data\n", compress_name);
                if (decompress) {
-                       res = decompress(buf, len, NULL, flush_buffer, NULL,
+                       int res = decompress(buf, len, NULL, flush_buffer, NULL,
                                   &my_inptr, error);
                        if (res)
                                error("decompressor failed");
index 86069d74c062d17ec094f44754ab197483bf910e..37f3c786348f21a233c7f8dc486d8ef3124e8dba 100644 (file)
@@ -54,7 +54,7 @@ static const struct compress_format compressed_formats[] __initconst = {
        { {0, 0}, NULL, NULL }
 };
 
-decompress_fn __init decompress_method(const unsigned char *inbuf, int len,
+decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
                                const char **name)
 {
        const struct compress_format *cf;
index 31c5f7675fbfa270a70a005247c8a3773067f5c0..8290e0bef7eabd9f4284b9e2558f8a4e9afab6b0 100644 (file)
@@ -92,8 +92,8 @@ struct bunzip_data {
        /* State for interrupting output loop */
        int writeCopies, writePos, writeRunCountdown, writeCount, writeCurrent;
        /* I/O tracking data (file handles, buffers, positions, etc.) */
-       int (*fill)(void*, unsigned int);
-       int inbufCount, inbufPos /*, outbufPos*/;
+       long (*fill)(void*, unsigned long);
+       long inbufCount, inbufPos /*, outbufPos*/;
        unsigned char *inbuf /*,*outbuf*/;
        unsigned int inbufBitCount, inbufBits;
        /* The CRC values stored in the block header and calculated from the
@@ -617,7 +617,7 @@ decode_next_byte:
        goto decode_next_byte;
 }
 
-static int INIT nofill(void *buf, unsigned int len)
+static long INIT nofill(void *buf, unsigned long len)
 {
        return -1;
 }
@@ -625,8 +625,8 @@ static int INIT nofill(void *buf, unsigned int len)
 /* Allocate the structure, read file header.  If in_fd ==-1, inbuf must contain
    a complete bunzip file (len bytes long).  If in_fd!=-1, inbuf and len are
    ignored, and data is read from file handle into temporary buffer. */
-static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
-                            int (*fill)(void*, unsigned int))
+static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, long len,
+                            long (*fill)(void*, unsigned long))
 {
        struct bunzip_data *bd;
        unsigned int i, j, c;
@@ -675,11 +675,11 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
 
 /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
    not end of file.) */
-STATIC int INIT bunzip2(unsigned char *buf, int len,
-                       int(*fill)(void*, unsigned int),
-                       int(*flush)(void*, unsigned int),
+STATIC int INIT bunzip2(unsigned char *buf, long len,
+                       long (*fill)(void*, unsigned long),
+                       long (*flush)(void*, unsigned long),
                        unsigned char *outbuf,
-                       int *pos,
+                       long *pos,
                        void(*error)(char *x))
 {
        struct bunzip_data *bd;
@@ -743,11 +743,11 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, int len,
-                       int(*fill)(void*, unsigned int),
-                       int(*flush)(void*, unsigned int),
+STATIC int INIT decompress(unsigned char *buf, long len,
+                       long (*fill)(void*, unsigned long),
+                       long (*flush)(void*, unsigned long),
                        unsigned char *outbuf,
-                       int *pos,
+                       long *pos,
                        void(*error)(char *x))
 {
        return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
index 0edfd742a1542c19b9432b65e9ce0751306a76f2..d4c7891635ecc2b1fb70b9f4fc75a216c782fe0d 100644 (file)
 
 #define GZIP_IOBUF_SIZE (16*1024)
 
-static int INIT nofill(void *buffer, unsigned int len)
+static long INIT nofill(void *buffer, unsigned long len)
 {
        return -1;
 }
 
 /* Included from initramfs et al code */
-STATIC int INIT gunzip(unsigned char *buf, int len,
-                      int(*fill)(void*, unsigned int),
-                      int(*flush)(void*, unsigned int),
+STATIC int INIT gunzip(unsigned char *buf, long len,
+                      long (*fill)(void*, unsigned long),
+                      long (*flush)(void*, unsigned long),
                       unsigned char *out_buf,
-                      int *pos,
+                      long *pos,
                       void(*error)(char *x)) {
        u8 *zbuf;
        struct z_stream_s *strm;
@@ -142,7 +142,7 @@ STATIC int INIT gunzip(unsigned char *buf, int len,
 
                /* Write any data generated */
                if (flush && strm->next_out > out_buf) {
-                       int l = strm->next_out - out_buf;
+                       long l = strm->next_out - out_buf;
                        if (l != flush(out_buf, l)) {
                                rc = -1;
                                error("write error");
index 3ad7f3954dfd23b27a87380e75d384f3056d609a..40f66ebe57b77a0566460a2407bdd713d6e0b3fc 100644 (file)
 #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20)
 #define ARCHIVE_MAGICNUMBER 0x184C2102
 
-STATIC inline int INIT unlz4(u8 *input, int in_len,
-                               int (*fill) (void *, unsigned int),
-                               int (*flush) (void *, unsigned int),
-                               u8 *output, int *posp,
+STATIC inline int INIT unlz4(u8 *input, long in_len,
+                               long (*fill)(void *, unsigned long),
+                               long (*flush)(void *, unsigned long),
+                               u8 *output, long *posp,
                                void (*error) (char *x))
 {
        int ret = -1;
@@ -43,7 +43,7 @@ STATIC inline int INIT unlz4(u8 *input, int in_len,
        u8 *inp;
        u8 *inp_start;
        u8 *outp;
-       int size = in_len;
+       long size = in_len;
 #ifdef PREBOOT
        size_t out_len = get_unaligned_le32(input + in_len);
 #endif
@@ -196,11 +196,11 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, int in_len,
-                             int(*fill)(void*, unsigned int),
-                             int(*flush)(void*, unsigned int),
+STATIC int INIT decompress(unsigned char *buf, long in_len,
+                             long (*fill)(void*, unsigned long),
+                             long (*flush)(void*, unsigned long),
                              unsigned char *output,
-                             int *posp,
+                             long *posp,
                              void(*error)(char *x)
        )
 {
index 32adb73a903811c4b05d49fea6f9401c13cf396e..0be83af62b884c3dbfa9f29f9630a5ecfd605e2f 100644 (file)
@@ -65,11 +65,11 @@ static long long INIT read_int(unsigned char *ptr, int size)
 #define LZMA_IOBUF_SIZE        0x10000
 
 struct rc {
-       int (*fill)(void*, unsigned int);
+       long (*fill)(void*, unsigned long);
        uint8_t *ptr;
        uint8_t *buffer;
        uint8_t *buffer_end;
-       int buffer_size;
+       long buffer_size;
        uint32_t code;
        uint32_t range;
        uint32_t bound;
@@ -82,7 +82,7 @@ struct rc {
 #define RC_MODEL_TOTAL_BITS 11
 
 
-static int INIT nofill(void *buffer, unsigned int len)
+static long INIT nofill(void *buffer, unsigned long len)
 {
        return -1;
 }
@@ -99,8 +99,8 @@ static void INIT rc_read(struct rc *rc)
 
 /* Called once */
 static inline void INIT rc_init(struct rc *rc,
-                                      int (*fill)(void*, unsigned int),
-                                      char *buffer, int buffer_size)
+                                      long (*fill)(void*, unsigned long),
+                                      char *buffer, long buffer_size)
 {
        if (fill)
                rc->fill = fill;
@@ -280,7 +280,7 @@ struct writer {
        size_t buffer_pos;
        int bufsize;
        size_t global_pos;
-       int(*flush)(void*, unsigned int);
+       long (*flush)(void*, unsigned long);
        struct lzma_header *header;
 };
 
@@ -534,11 +534,11 @@ static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
 
 
 
-STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
-                             int(*fill)(void*, unsigned int),
-                             int(*flush)(void*, unsigned int),
+STATIC inline int INIT unlzma(unsigned char *buf, long in_len,
+                             long (*fill)(void*, unsigned long),
+                             long (*flush)(void*, unsigned long),
                              unsigned char *output,
-                             int *posp,
+                             long *posp,
                              void(*error)(char *x)
        )
 {
@@ -667,11 +667,11 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, int in_len,
-                             int(*fill)(void*, unsigned int),
-                             int(*flush)(void*, unsigned int),
+STATIC int INIT decompress(unsigned char *buf, long in_len,
+                             long (*fill)(void*, unsigned long),
+                             long (*flush)(void*, unsigned long),
                              unsigned char *output,
-                             int *posp,
+                             long *posp,
                              void(*error)(char *x)
        )
 {
index 960183d4258f2bffda4dfa421525d04cdd40a949..b94a31bdd87d15f34a7f4902eb6170f800c01206 100644 (file)
@@ -51,7 +51,7 @@ static const unsigned char lzop_magic[] = {
 #define HEADER_SIZE_MIN       (9 + 7     + 4 + 8     + 1       + 4)
 #define HEADER_SIZE_MAX       (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)
 
-STATIC inline int INIT parse_header(u8 *input, int *skip, int in_len)
+STATIC inline long INIT parse_header(u8 *input, long *skip, long in_len)
 {
        int l;
        u8 *parse = input;
@@ -108,14 +108,14 @@ STATIC inline int INIT parse_header(u8 *input, int *skip, int in_len)
        return 1;
 }
 
-STATIC inline int INIT unlzo(u8 *input, int in_len,
-                               int (*fill) (void *, unsigned int),
-                               int (*flush) (void *, unsigned int),
-                               u8 *output, int *posp,
+STATIC int INIT unlzo(u8 *input, long in_len,
+                               long (*fill)(void *, unsigned long),
+                               long (*flush)(void *, unsigned long),
+                               u8 *output, long *posp,
                                void (*error) (char *x))
 {
        u8 r = 0;
-       int skip = 0;
+       long skip = 0;
        u32 src_len, dst_len;
        size_t tmp;
        u8 *in_buf, *in_buf_save, *out_buf;
index 9f34eb56854d64eeebd4dcfcc9993a64c6aa585a..b07a78340e9d315006a97194fbcccae0c4c16509 100644 (file)
@@ -248,10 +248,10 @@ void *memmove(void *dest, const void *src, size_t size)
  * both input and output buffers are available as a single chunk, i.e. when
  * fill() and flush() won't be used.
  */
-STATIC int INIT unxz(unsigned char *in, int in_size,
-                    int (*fill)(void *dest, unsigned int size),
-                    int (*flush)(void *src, unsigned int size),
-                    unsigned char *out, int *in_used,
+STATIC int INIT unxz(unsigned char *in, long in_size,
+                    long (*fill)(void *dest, unsigned long size),
+                    long (*flush)(void *src, unsigned long size),
+                    unsigned char *out, long *in_used,
                     void (*error)(char *x))
 {
        struct xz_buf b;
@@ -329,7 +329,7 @@ STATIC int INIT unxz(unsigned char *in, int in_size,
                                 * returned by xz_dec_run(), but probably
                                 * it's not too bad.
                                 */
-                               if (flush(b.out, b.out_pos) != (int)b.out_pos)
+                               if (flush(b.out, b.out_pos) != (long)b.out_pos)
                                        ret = XZ_BUF_ERROR;
 
                                b.out_pos = 0;