debuggers.hg

annotate 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
rev   line source
keir@20447 1 #include <xen/config.h>
keir@20447 2 #include <xen/init.h>
keir@20447 3 #include <xen/lib.h>
keir@20447 4 #include <xen/string.h>
keir@20447 5 #include <xen/decompress.h>
keir@20447 6
keir@20447 7 static void __init error(const char *msg)
keir@20447 8 {
keir@20447 9 printk("%s\n", msg);
keir@20447 10 }
keir@20447 11
keir@20447 12 int __init decompress(void *inbuf, unsigned int len, void *outbuf)
keir@20447 13 {
keir@20447 14 #if 0 /* Not needed here yet. */
keir@20447 15 if ( len >= 2 &&
keir@20447 16 (!memcmp(inbuf, "\037\213", 2) || !memcmp(inbuf, "\037\236", 2)) )
keir@20447 17 return gunzip(inbuf, len, NULL, NULL, outbuf, NULL, error);
keir@20447 18 #endif
keir@20447 19
keir@20447 20 if ( len >= 3 && !memcmp(inbuf, "\x42\x5a\x68", 3) )
keir@20447 21 return bunzip2(inbuf, len, NULL, NULL, outbuf, NULL, error);
keir@20447 22
keir@20447 23 if ( len >= 2 && !memcmp(inbuf, "\135\000", 2) )
keir@20447 24 return unlzma(inbuf, len, NULL, NULL, outbuf, NULL, error);
keir@20447 25
keir@21663 26 if ( len >= 5 && !memcmp(inbuf, "\x89LZO", 5) )
keir@21663 27 return unlzo(inbuf, len, NULL, NULL, outbuf, NULL, error);
keir@21663 28
keir@20447 29 return 1;
keir@20447 30 }