aboutsummaryrefslogtreecommitdiffstats
path: root/init/initramfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index a3ba91cdab89..2f42984e5582 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -416,13 +416,13 @@ static int __init flush_buffer(void *bufv, unsigned len)
416 416
417static unsigned my_inptr; /* index of next byte to be processed in inbuf */ 417static unsigned my_inptr; /* index of next byte to be processed in inbuf */
418 418
419#include <linux/decompress/bunzip2.h> 419#include <linux/decompress/generic.h>
420#include <linux/decompress/unlzma.h>
421#include <linux/decompress/inflate.h>
422 420
423static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) 421static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
424{ 422{
425 int written; 423 int written;
424 decompress_fn decompress;
425
426 dry_run = check_only; 426 dry_run = check_only;
427 header_buf = kmalloc(110, GFP_KERNEL); 427 header_buf = kmalloc(110, GFP_KERNEL);
428 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); 428 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
@@ -450,35 +450,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
450 continue; 450 continue;
451 } 451 }
452 this_header = 0; 452 this_header = 0;
453#ifdef CONFIG_RD_GZIP 453 decompress = decompress_method(buf, len, NULL);
454 if (!gunzip(buf, len, NULL, flush_buffer, NULL, 454 if (decompress)
455 &my_inptr, error) && 455 decompress(buf, len, NULL, flush_buffer, NULL,
456 message == NULL) 456 &my_inptr, error);
457 goto ok;
458#endif
459
460#ifdef CONFIG_RD_BZIP2
461 message = NULL; /* Zero out message, or else cpio will
462 think an error has already occured */
463 if (!bunzip2(buf, len, NULL, flush_buffer, NULL,
464 &my_inptr, error) &&
465 message == NULL) {
466 goto ok;
467 }
468#endif
469
470#ifdef CONFIG_RD_LZMA
471 message = NULL; /* Zero out message, or else cpio will
472 think an error has already occured */
473 if (!unlzma(buf, len, NULL, flush_buffer, NULL,
474 &my_inptr, error) &&
475 message == NULL) {
476 goto ok;
477 }
478#endif
479#if defined CONFIG_RD_GZIP || defined CONFIG_RD_BZIP2 || defined CONFIG_RD_LZMA
480ok:
481#endif
482 if (state != Reset) 457 if (state != Reset)
483 error("junk in compressed archive"); 458 error("junk in compressed archive");
484 this_header = saved_offset + my_inptr; 459 this_header = saved_offset + my_inptr;