debuggers.hg

view xen/common/decompress.c @ 22906:700ac6445812

Now add KDB to the non-kdb tree
author Mukesh Rathor
date Thu Feb 03 15:42:41 2011 -0800 (2011-02-03)
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 }