WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 10/10] Support transparant gunzipping in the readnote

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 10/10] Support transparant gunzipping in the readnotes utility.
From: Gerd Hoffmann <kraxel@xxxxxxx>
Date: Mon, 04 Dec 2006 11:58:34 +0100
Delivery-date: Mon, 04 Dec 2006 03:04:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20061204105824.942096000@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.44-15
Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxx>
---
 tools/xcutils/readnotes.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Index: build-32-unstable-12621/tools/xcutils/readnotes.c
===================================================================
--- build-32-unstable-12621.orig/tools/xcutils/readnotes.c
+++ build-32-unstable-12621/tools/xcutils/readnotes.c
@@ -11,6 +11,7 @@
 #include <sys/mman.h>
 
 #include <xg_private.h>
+#include <xc_dom.h> /* gunzip bits */
 
 #include <xen/libelf.h>
 
@@ -33,8 +34,8 @@ static void print_numeric_note(const cha
 int main(int argc, char **argv)
 {
        const char *f;
-       int fd,h,size,count;
-       void *image;
+       int fd,h,size,usize,count;
+       void *image,*tmp;
        struct stat st;
        struct elf_binary elf;
        const elf_shdr *shdr;
@@ -68,6 +69,15 @@ int main(int argc, char **argv)
        }
        size = st.st_size;
 
+       usize = xc_dom_check_gzip(image, st.st_size);
+       if (usize)
+       {
+               tmp = malloc(size);
+               xc_dom_do_gunzip(image, st.st_size, tmp, size);
+               image = tmp;
+               size = usize;
+       }
+
        if (0 != elf_init(&elf, image, size))
        {
                fprintf(stderr, "File %s is not an ELF image\n", f);

--

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel