debuggers.hg

view xen/common/decompress.c @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents d8333666361d
children
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/string.h>
5 #include <xen/decompress.h>
7 static void __init error(const char *msg)
8 {
9 printk("%s\n", msg);
10 }
12 int __init decompress(void *inbuf, unsigned int len, void *outbuf)
13 {
14 #if 0 /* Not needed here yet. */
15 if ( len >= 2 &&
16 (!memcmp(inbuf, "\037\213", 2) || !memcmp(inbuf, "\037\236", 2)) )
17 return gunzip(inbuf, len, NULL, NULL, outbuf, NULL, error);
18 #endif
20 if ( len >= 3 && !memcmp(inbuf, "\x42\x5a\x68", 3) )
21 return bunzip2(inbuf, len, NULL, NULL, outbuf, NULL, error);
23 if ( len >= 2 && !memcmp(inbuf, "\135\000", 2) )
24 return unlzma(inbuf, len, NULL, NULL, outbuf, NULL, error);
26 if ( len >= 5 && !memcmp(inbuf, "\x89LZO", 5) )
27 return unlzo(inbuf, len, NULL, NULL, outbuf, NULL, error);
29 return 1;
30 }