aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xcutils/readnotes.c
diff options
context:
space:
mode:
authorEmmanuel Ackaouy <ack@xensource.com>2007-01-25 22:16:52 +0000
committerEmmanuel Ackaouy <ack@xensource.com>2007-01-25 22:16:52 +0000
commit62e3530a351b7d62d77d52648bacb77aaa375762 (patch)
treed45ce1b7877b5e8c54b3c9ed764adba74fb593f6 /tools/xcutils/readnotes.c
parent2be4a20325eaff61f1a14fe43de84a88fdf248f5 (diff)
downloadxen-62e3530a351b7d62d77d52648bacb77aaa375762.tar.gz
xen-62e3530a351b7d62d77d52648bacb77aaa375762.tar.bz2
xen-62e3530a351b7d62d77d52648bacb77aaa375762.zip
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(-)
Diffstat (limited to 'tools/xcutils/readnotes.c')
-rw-r--r--tools/xcutils/readnotes.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/xcutils/readnotes.c b/tools/xcutils/readnotes.c
index 4160e8ec8d..fac684014a 100644
--- a/tools/xcutils/readnotes.c
+++ b/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 char *prefix, struct elf_binary *elf,
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);