ia64/xen-unstable

changeset 13641:9d1d9877131d

Support transparant gunzipping in the readnotes utility.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
tools/xcutils/readnotes.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
author Emmanuel Ackaouy <ack@xensource.com>
date Thu Jan 25 22:16:52 2007 +0000 (2007-01-25)
parents d42878949f63
children ba3ec84c9423
files tools/xcutils/readnotes.c
line diff
     1.1 --- a/tools/xcutils/readnotes.c	Thu Jan 25 22:16:52 2007 +0000
     1.2 +++ b/tools/xcutils/readnotes.c	Thu Jan 25 22:16:52 2007 +0000
     1.3 @@ -11,6 +11,7 @@
     1.4  #include <sys/mman.h>
     1.5  
     1.6  #include <xg_private.h>
     1.7 +#include <xc_dom.h> /* gunzip bits */
     1.8  
     1.9  #include <xen/libelf.h>
    1.10  
    1.11 @@ -33,8 +34,8 @@ static void print_numeric_note(const cha
    1.12  int main(int argc, char **argv)
    1.13  {
    1.14  	const char *f;
    1.15 -	int fd,h,size,count;
    1.16 -	void *image;
    1.17 +	int fd,h,size,usize,count;
    1.18 +	void *image,*tmp;
    1.19  	struct stat st;
    1.20  	struct elf_binary elf;
    1.21  	const elf_shdr *shdr;
    1.22 @@ -68,6 +69,15 @@ int main(int argc, char **argv)
    1.23  	}
    1.24  	size = st.st_size;
    1.25  
    1.26 +	usize = xc_dom_check_gzip(image, st.st_size);
    1.27 +	if (usize)
    1.28 +	{
    1.29 +		tmp = malloc(size);
    1.30 +		xc_dom_do_gunzip(image, st.st_size, tmp, size);
    1.31 +		image = tmp;
    1.32 +		size = usize;
    1.33 +	}
    1.34 +
    1.35  	if (0 != elf_init(&elf, image, size))
    1.36  	{
    1.37  		fprintf(stderr, "File %s is not an ELF image\n", f);