diff options
Diffstat (limited to 'init/do_mounts_rd.c')
-rw-r--r-- | init/do_mounts_rd.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 9c9d7dbcf9ca..a06ed4f92e0e 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c | |||
@@ -12,9 +12,6 @@ | |||
12 | 12 | ||
13 | #include <linux/decompress/generic.h> | 13 | #include <linux/decompress/generic.h> |
14 | 14 | ||
15 | #include <linux/decompress/bunzip2.h> | ||
16 | #include <linux/decompress/unlzma.h> | ||
17 | #include <linux/decompress/inflate.h> | ||
18 | 15 | ||
19 | int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */ | 16 | int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */ |
20 | 17 | ||
@@ -49,24 +46,6 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco); | |||
49 | * cramfs | 46 | * cramfs |
50 | * gzip | 47 | * gzip |
51 | */ | 48 | */ |
52 | static const struct compress_format { | ||
53 | unsigned char magic[2]; | ||
54 | const char *name; | ||
55 | decompress_fn decompressor; | ||
56 | } compressed_formats[] = { | ||
57 | #ifdef CONFIG_RD_GZIP | ||
58 | { {037, 0213}, "gzip", gunzip }, | ||
59 | { {037, 0236}, "gzip", gunzip }, | ||
60 | #endif | ||
61 | #ifdef CONFIG_RD_BZIP2 | ||
62 | { {0x42, 0x5a}, "bzip2", bunzip2 }, | ||
63 | #endif | ||
64 | #ifdef CONFIG_RD_LZMA | ||
65 | { {0x5d, 0x00}, "lzma", unlzma }, | ||
66 | #endif | ||
67 | { {0, 0}, NULL, NULL } | ||
68 | }; | ||
69 | |||
70 | static int __init | 49 | static int __init |
71 | identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) | 50 | identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) |
72 | { | 51 | { |
@@ -77,7 +56,7 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) | |||
77 | struct cramfs_super *cramfsb; | 56 | struct cramfs_super *cramfsb; |
78 | int nblocks = -1; | 57 | int nblocks = -1; |
79 | unsigned char *buf; | 58 | unsigned char *buf; |
80 | const struct compress_format *cf; | 59 | const char *compress_name; |
81 | 60 | ||
82 | buf = kmalloc(size, GFP_KERNEL); | 61 | buf = kmalloc(size, GFP_KERNEL); |
83 | if (!buf) | 62 | if (!buf) |
@@ -95,15 +74,12 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) | |||
95 | sys_lseek(fd, start_block * BLOCK_SIZE, 0); | 74 | sys_lseek(fd, start_block * BLOCK_SIZE, 0); |
96 | sys_read(fd, buf, size); | 75 | sys_read(fd, buf, size); |
97 | 76 | ||
98 | for (cf = compressed_formats; cf->decompressor; cf++) { | 77 | *decompressor = decompress_method(buf, size, &compress_name); |
99 | if (buf[0] == cf->magic[0] && buf[1] == cf->magic[1]) { | 78 | if (*decompressor) { |
100 | printk(KERN_NOTICE | 79 | printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n", |
101 | "RAMDISK: %s image found at block %d\n", | 80 | compress_name, start_block); |
102 | cf->name, start_block); | 81 | nblocks = 0; |
103 | *decompressor = cf->decompressor; | 82 | goto done; |
104 | nblocks = 0; | ||
105 | goto done; | ||
106 | } | ||
107 | } | 83 | } |
108 | 84 | ||
109 | /* romfs is at block zero too */ | 85 | /* romfs is at block zero too */ |