Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

initramfs: support initramfs that is bigger than 2GiB

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>

authored by

Yinghai Lu and committed by
Linus Torvalds
d97b07c5 38747439

+111 -110
+4 -4
crypto/zlib.c
··· 168 168 } 169 169 170 170 ret = req->avail_out - stream->avail_out; 171 - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", 171 + pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n", 172 172 stream->avail_in, stream->avail_out, 173 173 req->avail_in - stream->avail_in, ret); 174 174 req->next_in = stream->next_in; ··· 198 198 } 199 199 200 200 ret = req->avail_out - stream->avail_out; 201 - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", 201 + pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n", 202 202 stream->avail_in, stream->avail_out, 203 203 req->avail_in - stream->avail_in, ret); 204 204 req->next_in = stream->next_in; ··· 283 283 } 284 284 285 285 ret = req->avail_out - stream->avail_out; 286 - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", 286 + pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n", 287 287 stream->avail_in, stream->avail_out, 288 288 req->avail_in - stream->avail_in, ret); 289 289 req->next_in = stream->next_in; ··· 331 331 } 332 332 333 333 ret = req->avail_out - stream->avail_out; 334 - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", 334 + pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n", 335 335 stream->avail_in, stream->avail_out, 336 336 req->avail_in - stream->avail_in, ret); 337 337 req->next_in = stream->next_in;
+2 -2
fs/isofs/compress.c
··· 158 158 "zisofs: zisofs_inflate returned" 159 159 " %d, inode = %lu," 160 160 " page idx = %d, bh idx = %d," 161 - " avail_in = %d," 162 - " avail_out = %d\n", 161 + " avail_in = %ld," 162 + " avail_out = %ld\n", 163 163 zerr, inode->i_ino, curpage, 164 164 curbh, stream.avail_in, 165 165 stream.avail_out);
+4 -3
fs/jffs2/compr_zlib.c
··· 94 94 95 95 while (def_strm.total_out < *dstlen - STREAM_END_SPACE && def_strm.total_in < *sourcelen) { 96 96 def_strm.avail_out = *dstlen - (def_strm.total_out + STREAM_END_SPACE); 97 - def_strm.avail_in = min((unsigned)(*sourcelen-def_strm.total_in), def_strm.avail_out); 98 - jffs2_dbg(1, "calling deflate with avail_in %d, avail_out %d\n", 97 + def_strm.avail_in = min_t(unsigned long, 98 + (*sourcelen-def_strm.total_in), def_strm.avail_out); 99 + jffs2_dbg(1, "calling deflate with avail_in %ld, avail_out %ld\n", 99 100 def_strm.avail_in, def_strm.avail_out); 100 101 ret = zlib_deflate(&def_strm, Z_PARTIAL_FLUSH); 101 - jffs2_dbg(1, "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", 102 + jffs2_dbg(1, "deflate returned with avail_in %ld, avail_out %ld, total_in %ld, total_out %ld\n", 102 103 def_strm.avail_in, def_strm.avail_out, 103 104 def_strm.total_in, def_strm.total_out); 104 105 if (ret != Z_OK) {
+4 -4
include/linux/decompress/bunzip2.h
··· 1 1 #ifndef DECOMPRESS_BUNZIP2_H 2 2 #define DECOMPRESS_BUNZIP2_H 3 3 4 - int bunzip2(unsigned char *inbuf, int len, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + int bunzip2(unsigned char *inbuf, long len, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *output, 8 - int *pos, 8 + long *pos, 9 9 void(*error)(char *x)); 10 10 #endif
+5 -5
include/linux/decompress/generic.h
··· 1 1 #ifndef DECOMPRESS_GENERIC_H 2 2 #define DECOMPRESS_GENERIC_H 3 3 4 - typedef int (*decompress_fn) (unsigned char *inbuf, int len, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + typedef int (*decompress_fn) (unsigned char *inbuf, long len, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *outbuf, 8 - int *posp, 8 + long *posp, 9 9 void(*error)(char *x)); 10 10 11 11 /* inbuf - input buffer ··· 33 33 34 34 35 35 /* Utility routine to detect the decompression method */ 36 - decompress_fn decompress_method(const unsigned char *inbuf, int len, 36 + decompress_fn decompress_method(const unsigned char *inbuf, long len, 37 37 const char **name); 38 38 39 39 #endif
+4 -4
include/linux/decompress/inflate.h
··· 1 1 #ifndef LINUX_DECOMPRESS_INFLATE_H 2 2 #define LINUX_DECOMPRESS_INFLATE_H 3 3 4 - int gunzip(unsigned char *inbuf, int len, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + int gunzip(unsigned char *inbuf, long len, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *output, 8 - int *pos, 8 + long *pos, 9 9 void(*error_fn)(char *x)); 10 10 #endif
+4 -4
include/linux/decompress/unlz4.h
··· 1 1 #ifndef DECOMPRESS_UNLZ4_H 2 2 #define DECOMPRESS_UNLZ4_H 3 3 4 - int unlz4(unsigned char *inbuf, int len, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + int unlz4(unsigned char *inbuf, long len, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *output, 8 - int *pos, 8 + long *pos, 9 9 void(*error)(char *x)); 10 10 #endif
+4 -4
include/linux/decompress/unlzma.h
··· 1 1 #ifndef DECOMPRESS_UNLZMA_H 2 2 #define DECOMPRESS_UNLZMA_H 3 3 4 - int unlzma(unsigned char *, int, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + int unlzma(unsigned char *, long, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *output, 8 - int *posp, 8 + long *posp, 9 9 void(*error)(char *x) 10 10 ); 11 11
+4 -4
include/linux/decompress/unlzo.h
··· 1 1 #ifndef DECOMPRESS_UNLZO_H 2 2 #define DECOMPRESS_UNLZO_H 3 3 4 - int unlzo(unsigned char *inbuf, int len, 5 - int(*fill)(void*, unsigned int), 6 - int(*flush)(void*, unsigned int), 4 + int unlzo(unsigned char *inbuf, long len, 5 + long (*fill)(void*, unsigned long), 6 + long (*flush)(void*, unsigned long), 7 7 unsigned char *output, 8 - int *pos, 8 + long *pos, 9 9 void(*error)(char *x)); 10 10 #endif
+4 -4
include/linux/decompress/unxz.h
··· 10 10 #ifndef DECOMPRESS_UNXZ_H 11 11 #define DECOMPRESS_UNXZ_H 12 12 13 - int unxz(unsigned char *in, int in_size, 14 - int (*fill)(void *dest, unsigned int size), 15 - int (*flush)(void *src, unsigned int size), 16 - unsigned char *out, int *in_used, 13 + int unxz(unsigned char *in, long in_size, 14 + long (*fill)(void *dest, unsigned long size), 15 + long (*flush)(void *src, unsigned long size), 16 + unsigned char *out, long *in_used, 17 17 void (*error)(char *x)); 18 18 19 19 #endif
+2 -2
include/linux/zlib.h
··· 83 83 84 84 typedef struct z_stream_s { 85 85 const Byte *next_in; /* next input byte */ 86 - uInt avail_in; /* number of bytes available at next_in */ 86 + uLong avail_in; /* number of bytes available at next_in */ 87 87 uLong total_in; /* total nb of input bytes read so far */ 88 88 89 89 Byte *next_out; /* next output byte should be put there */ 90 - uInt avail_out; /* remaining free space at next_out */ 90 + uLong avail_out; /* remaining free space at next_out */ 91 91 uLong total_out; /* total nb of bytes output so far */ 92 92 93 93 char *msg; /* last error message, NULL if no error */
+5 -5
init/do_mounts_rd.c
··· 311 311 static int decompress_error; 312 312 static int crd_infd, crd_outfd; 313 313 314 - static int __init compr_fill(void *buf, unsigned int len) 314 + static long __init compr_fill(void *buf, unsigned long len) 315 315 { 316 - int r = sys_read(crd_infd, buf, len); 316 + long r = sys_read(crd_infd, buf, len); 317 317 if (r < 0) 318 318 printk(KERN_ERR "RAMDISK: error while reading compressed data"); 319 319 else if (r == 0) ··· 321 321 return r; 322 322 } 323 323 324 - static int __init compr_flush(void *window, unsigned int outcnt) 324 + static long __init compr_flush(void *window, unsigned long outcnt) 325 325 { 326 - int written = sys_write(crd_outfd, window, outcnt); 326 + long written = sys_write(crd_outfd, window, outcnt); 327 327 if (written != outcnt) { 328 328 if (decompress_error == 0) 329 329 printk(KERN_ERR 330 - "RAMDISK: incomplete write (%d != %d)\n", 330 + "RAMDISK: incomplete write (%ld != %ld)\n", 331 331 written, outcnt); 332 332 decompress_error = 1; 333 333 return -1;
+11 -11
init/initramfs.c
··· 197 197 } state, next_state; 198 198 199 199 static __initdata char *victim; 200 - static __initdata unsigned count; 200 + static unsigned long count __initdata; 201 201 static __initdata loff_t this_header, next_header; 202 202 203 203 static inline void __init eat(unsigned n) ··· 209 209 210 210 static __initdata char *vcollected; 211 211 static __initdata char *collected; 212 - static __initdata int remains; 212 + static long remains __initdata; 213 213 static __initdata char *collect; 214 214 215 215 static void __init read_into(char *buf, unsigned size, enum state next) ··· 236 236 237 237 static int __init do_collect(void) 238 238 { 239 - unsigned n = remains; 239 + unsigned long n = remains; 240 240 if (count < n) 241 241 n = count; 242 242 memcpy(collect, victim, n); ··· 407 407 [Reset] = do_reset, 408 408 }; 409 409 410 - static int __init write_buffer(char *buf, unsigned len) 410 + static long __init write_buffer(char *buf, unsigned long len) 411 411 { 412 412 count = len; 413 413 victim = buf; ··· 417 417 return len - count; 418 418 } 419 419 420 - static int __init flush_buffer(void *bufv, unsigned len) 420 + static long __init flush_buffer(void *bufv, unsigned long len) 421 421 { 422 422 char *buf = (char *) bufv; 423 - int written; 424 - int origLen = len; 423 + long written; 424 + long origLen = len; 425 425 if (message) 426 426 return -1; 427 427 while ((written = write_buffer(buf, len)) < len && !message) { ··· 440 440 return origLen; 441 441 } 442 442 443 - static unsigned my_inptr; /* index of next byte to be processed in inbuf */ 443 + static unsigned long my_inptr; /* index of next byte to be processed in inbuf */ 444 444 445 445 #include <linux/decompress/generic.h> 446 446 447 - static char * __init unpack_to_rootfs(char *buf, unsigned len) 447 + static char * __init unpack_to_rootfs(char *buf, unsigned long len) 448 448 { 449 - int written, res; 449 + long written; 450 450 decompress_fn decompress; 451 451 const char *compress_name; 452 452 static __initdata char msg_buf[64]; ··· 480 480 decompress = decompress_method(buf, len, &compress_name); 481 481 pr_debug("Detected %s compressed data\n", compress_name); 482 482 if (decompress) { 483 - res = decompress(buf, len, NULL, flush_buffer, NULL, 483 + int res = decompress(buf, len, NULL, flush_buffer, NULL, 484 484 &my_inptr, error); 485 485 if (res) 486 486 error("decompressor failed");
+1 -1
lib/decompress.c
··· 54 54 { {0, 0}, NULL, NULL } 55 55 }; 56 56 57 - decompress_fn __init decompress_method(const unsigned char *inbuf, int len, 57 + decompress_fn __init decompress_method(const unsigned char *inbuf, long len, 58 58 const char **name) 59 59 { 60 60 const struct compress_format *cf;
+13 -13
lib/decompress_bunzip2.c
··· 92 92 /* State for interrupting output loop */ 93 93 int writeCopies, writePos, writeRunCountdown, writeCount, writeCurrent; 94 94 /* I/O tracking data (file handles, buffers, positions, etc.) */ 95 - int (*fill)(void*, unsigned int); 96 - int inbufCount, inbufPos /*, outbufPos*/; 95 + long (*fill)(void*, unsigned long); 96 + long inbufCount, inbufPos /*, outbufPos*/; 97 97 unsigned char *inbuf /*,*outbuf*/; 98 98 unsigned int inbufBitCount, inbufBits; 99 99 /* The CRC values stored in the block header and calculated from the ··· 617 617 goto decode_next_byte; 618 618 } 619 619 620 - static int INIT nofill(void *buf, unsigned int len) 620 + static long INIT nofill(void *buf, unsigned long len) 621 621 { 622 622 return -1; 623 623 } ··· 625 625 /* Allocate the structure, read file header. If in_fd ==-1, inbuf must contain 626 626 a complete bunzip file (len bytes long). If in_fd!=-1, inbuf and len are 627 627 ignored, and data is read from file handle into temporary buffer. */ 628 - static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len, 629 - int (*fill)(void*, unsigned int)) 628 + static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, long len, 629 + long (*fill)(void*, unsigned long)) 630 630 { 631 631 struct bunzip_data *bd; 632 632 unsigned int i, j, c; ··· 675 675 676 676 /* Example usage: decompress src_fd to dst_fd. (Stops at end of bzip2 data, 677 677 not end of file.) */ 678 - STATIC int INIT bunzip2(unsigned char *buf, int len, 679 - int(*fill)(void*, unsigned int), 680 - int(*flush)(void*, unsigned int), 678 + STATIC int INIT bunzip2(unsigned char *buf, long len, 679 + long (*fill)(void*, unsigned long), 680 + long (*flush)(void*, unsigned long), 681 681 unsigned char *outbuf, 682 - int *pos, 682 + long *pos, 683 683 void(*error)(char *x)) 684 684 { 685 685 struct bunzip_data *bd; ··· 743 743 } 744 744 745 745 #ifdef PREBOOT 746 - STATIC int INIT decompress(unsigned char *buf, int len, 747 - int(*fill)(void*, unsigned int), 748 - int(*flush)(void*, unsigned int), 746 + STATIC int INIT decompress(unsigned char *buf, long len, 747 + long (*fill)(void*, unsigned long), 748 + long (*flush)(void*, unsigned long), 749 749 unsigned char *outbuf, 750 - int *pos, 750 + long *pos, 751 751 void(*error)(char *x)) 752 752 { 753 753 return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
+6 -6
lib/decompress_inflate.c
··· 27 27 28 28 #define GZIP_IOBUF_SIZE (16*1024) 29 29 30 - static int INIT nofill(void *buffer, unsigned int len) 30 + static long INIT nofill(void *buffer, unsigned long len) 31 31 { 32 32 return -1; 33 33 } 34 34 35 35 /* Included from initramfs et al code */ 36 - STATIC int INIT gunzip(unsigned char *buf, int len, 37 - int(*fill)(void*, unsigned int), 38 - int(*flush)(void*, unsigned int), 36 + STATIC int INIT gunzip(unsigned char *buf, long len, 37 + long (*fill)(void*, unsigned long), 38 + long (*flush)(void*, unsigned long), 39 39 unsigned char *out_buf, 40 - int *pos, 40 + long *pos, 41 41 void(*error)(char *x)) { 42 42 u8 *zbuf; 43 43 struct z_stream_s *strm; ··· 142 142 143 143 /* Write any data generated */ 144 144 if (flush && strm->next_out > out_buf) { 145 - int l = strm->next_out - out_buf; 145 + long l = strm->next_out - out_buf; 146 146 if (l != flush(out_buf, l)) { 147 147 rc = -1; 148 148 error("write error");
+9 -9
lib/decompress_unlz4.c
··· 31 31 #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20) 32 32 #define ARCHIVE_MAGICNUMBER 0x184C2102 33 33 34 - STATIC inline int INIT unlz4(u8 *input, int in_len, 35 - int (*fill) (void *, unsigned int), 36 - int (*flush) (void *, unsigned int), 37 - u8 *output, int *posp, 34 + STATIC inline int INIT unlz4(u8 *input, long in_len, 35 + long (*fill)(void *, unsigned long), 36 + long (*flush)(void *, unsigned long), 37 + u8 *output, long *posp, 38 38 void (*error) (char *x)) 39 39 { 40 40 int ret = -1; ··· 43 43 u8 *inp; 44 44 u8 *inp_start; 45 45 u8 *outp; 46 - int size = in_len; 46 + long size = in_len; 47 47 #ifdef PREBOOT 48 48 size_t out_len = get_unaligned_le32(input + in_len); 49 49 #endif ··· 196 196 } 197 197 198 198 #ifdef PREBOOT 199 - STATIC int INIT decompress(unsigned char *buf, int in_len, 200 - int(*fill)(void*, unsigned int), 201 - int(*flush)(void*, unsigned int), 199 + STATIC int INIT decompress(unsigned char *buf, long in_len, 200 + long (*fill)(void*, unsigned long), 201 + long (*flush)(void*, unsigned long), 202 202 unsigned char *output, 203 - int *posp, 203 + long *posp, 204 204 void(*error)(char *x) 205 205 ) 206 206 {
+14 -14
lib/decompress_unlzma.c
··· 65 65 #define LZMA_IOBUF_SIZE 0x10000 66 66 67 67 struct rc { 68 - int (*fill)(void*, unsigned int); 68 + long (*fill)(void*, unsigned long); 69 69 uint8_t *ptr; 70 70 uint8_t *buffer; 71 71 uint8_t *buffer_end; 72 - int buffer_size; 72 + long buffer_size; 73 73 uint32_t code; 74 74 uint32_t range; 75 75 uint32_t bound; ··· 82 82 #define RC_MODEL_TOTAL_BITS 11 83 83 84 84 85 - static int INIT nofill(void *buffer, unsigned int len) 85 + static long INIT nofill(void *buffer, unsigned long len) 86 86 { 87 87 return -1; 88 88 } ··· 99 99 100 100 /* Called once */ 101 101 static inline void INIT rc_init(struct rc *rc, 102 - int (*fill)(void*, unsigned int), 103 - char *buffer, int buffer_size) 102 + long (*fill)(void*, unsigned long), 103 + char *buffer, long buffer_size) 104 104 { 105 105 if (fill) 106 106 rc->fill = fill; ··· 280 280 size_t buffer_pos; 281 281 int bufsize; 282 282 size_t global_pos; 283 - int(*flush)(void*, unsigned int); 283 + long (*flush)(void*, unsigned long); 284 284 struct lzma_header *header; 285 285 }; 286 286 ··· 534 534 535 535 536 536 537 - STATIC inline int INIT unlzma(unsigned char *buf, int in_len, 538 - int(*fill)(void*, unsigned int), 539 - int(*flush)(void*, unsigned int), 537 + STATIC inline int INIT unlzma(unsigned char *buf, long in_len, 538 + long (*fill)(void*, unsigned long), 539 + long (*flush)(void*, unsigned long), 540 540 unsigned char *output, 541 - int *posp, 541 + long *posp, 542 542 void(*error)(char *x) 543 543 ) 544 544 { ··· 667 667 } 668 668 669 669 #ifdef PREBOOT 670 - STATIC int INIT decompress(unsigned char *buf, int in_len, 671 - int(*fill)(void*, unsigned int), 672 - int(*flush)(void*, unsigned int), 670 + STATIC int INIT decompress(unsigned char *buf, long in_len, 671 + long (*fill)(void*, unsigned long), 672 + long (*flush)(void*, unsigned long), 673 673 unsigned char *output, 674 - int *posp, 674 + long *posp, 675 675 void(*error)(char *x) 676 676 ) 677 677 {
+6 -6
lib/decompress_unlzo.c
··· 51 51 #define HEADER_SIZE_MIN (9 + 7 + 4 + 8 + 1 + 4) 52 52 #define HEADER_SIZE_MAX (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4) 53 53 54 - STATIC inline int INIT parse_header(u8 *input, int *skip, int in_len) 54 + STATIC inline long INIT parse_header(u8 *input, long *skip, long in_len) 55 55 { 56 56 int l; 57 57 u8 *parse = input; ··· 108 108 return 1; 109 109 } 110 110 111 - STATIC inline int INIT unlzo(u8 *input, int in_len, 112 - int (*fill) (void *, unsigned int), 113 - int (*flush) (void *, unsigned int), 114 - u8 *output, int *posp, 111 + STATIC int INIT unlzo(u8 *input, long in_len, 112 + long (*fill)(void *, unsigned long), 113 + long (*flush)(void *, unsigned long), 114 + u8 *output, long *posp, 115 115 void (*error) (char *x)) 116 116 { 117 117 u8 r = 0; 118 - int skip = 0; 118 + long skip = 0; 119 119 u32 src_len, dst_len; 120 120 size_t tmp; 121 121 u8 *in_buf, *in_buf_save, *out_buf;
+5 -5
lib/decompress_unxz.c
··· 248 248 * both input and output buffers are available as a single chunk, i.e. when 249 249 * fill() and flush() won't be used. 250 250 */ 251 - STATIC int INIT unxz(unsigned char *in, int in_size, 252 - int (*fill)(void *dest, unsigned int size), 253 - int (*flush)(void *src, unsigned int size), 254 - unsigned char *out, int *in_used, 251 + STATIC int INIT unxz(unsigned char *in, long in_size, 252 + long (*fill)(void *dest, unsigned long size), 253 + long (*flush)(void *src, unsigned long size), 254 + unsigned char *out, long *in_used, 255 255 void (*error)(char *x)) 256 256 { 257 257 struct xz_buf b; ··· 329 329 * returned by xz_dec_run(), but probably 330 330 * it's not too bad. 331 331 */ 332 - if (flush(b.out, b.out_pos) != (int)b.out_pos) 332 + if (flush(b.out, b.out_pos) != (long)b.out_pos) 333 333 ret = XZ_BUF_ERROR; 334 334 335 335 b.out_pos = 0;