aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2009-01-12 17:24:04 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2009-01-12 17:34:31 -0500
commit23a22d57a8962479ca630c9542e62d6f86fdf927 (patch)
tree5839f8f3125a7ddf90eb6c679908206ba464b7af /lib
parent736f93236ce786d1bcf09ad4dcb38a360d35ea1b (diff)
bzip2/lzma: comprehensible error messages for missing decompressor
Instead of failing to identify a compressed image with a decompressor that we don't have compiled in, identify it and fail with a comprehensible panic message. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/decompress.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/decompress.c b/lib/decompress.c
index edac55cc7823..961f367320fc 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -13,21 +13,25 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/string.h> 14#include <linux/string.h>
15 15
16#ifndef CONFIG_DECOMPRESS_GZIP
17# define gunzip NULL
18#endif
19#ifndef CONFIG_DECOMPRESS_BZIP2
20# define bunzip2 NULL
21#endif
22#ifndef CONFIG_DECOMPRESS_LZMA
23# define unlzma NULL
24#endif
25
16static const struct compress_format { 26static const struct compress_format {
17 unsigned char magic[2]; 27 unsigned char magic[2];
18 const char *name; 28 const char *name;
19 decompress_fn decompressor; 29 decompress_fn decompressor;
20} compressed_formats[] = { 30} compressed_formats[] = {
21#ifdef CONFIG_DECOMPRESS_GZIP
22 { {037, 0213}, "gzip", gunzip }, 31 { {037, 0213}, "gzip", gunzip },
23 { {037, 0236}, "gzip", gunzip }, 32 { {037, 0236}, "gzip", gunzip },
24#endif
25#ifdef CONFIG_DECOMPRESS_BZIP2
26 { {0x42, 0x5a}, "bzip2", bunzip2 }, 33 { {0x42, 0x5a}, "bzip2", bunzip2 },
27#endif
28#ifdef CONFIG_DECOMPRESS_LZMA
29 { {0x5d, 0x00}, "lzma", unlzma }, 34 { {0x5d, 0x00}, "lzma", unlzma },
30#endif
31 { {0, 0}, NULL, NULL } 35 { {0, 0}, NULL, NULL }
32}; 36};
33 37