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-changelog

[Xen-changelog] [xen-unstable] [XEND] No need to decompress the initrd w

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] No need to decompress the initrd when building a domain.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Oct 2006 15:40:13 +0000
Delivery-date: Mon, 09 Oct 2006 08:40:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 30f13007be3fa4206332aa7da2e951644d002822
# Parent  411c6aca255c9be78cab2a91e4131a3e9807ea60
[XEND] No need to decompress the initrd when building a domain.
The guest OS should be capable of parsing an image file in
whatever format was produced by that OS's tools. Furthermore,
we have seen initrd images with trailing garbage. This causes
us to calculate the wrong size for the uncompressed data and hence
fail to build the guest.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux_build.c |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diff -r 411c6aca255c -r 30f13007be3f tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Mon Oct 09 13:46:34 2006 +0100
+++ b/tools/libxc/xc_linux_build.c      Mon Oct 09 13:50:00 2006 +0100
@@ -38,7 +38,7 @@ struct initrd_info {
     enum { INITRD_none, INITRD_file, INITRD_mem } type;
     unsigned long len;
     union {
-        gzFile file_handle;
+        int fd;
         char *mem_addr;
     } u;
 };
@@ -152,7 +152,7 @@ int load_initrd(int xc_handle, domid_t d
         }
         else
         {
-            if ( gzread(initrd->u.file_handle, page, PAGE_SIZE) == -1 )
+            if ( read(initrd->u.fd, page, PAGE_SIZE) == -1 )
             {
                 PERROR("Error reading initrd image, could not");
                 return -EINVAL;
@@ -1344,20 +1344,16 @@ int xc_linux_build(int xc_handle,
 
     if ( (initrd_name != NULL) && (strlen(initrd_name) != 0) )
     {
+        if ( (fd = open(initrd_name, O_RDONLY)) < 0 )
+        {
+            PERROR("Could not open the initial ramdisk image");
+            goto error_out;
+        }
+
         initrd_info.type = INITRD_file;
-
-        if ( (fd = open(initrd_name, O_RDONLY)) < 0 )
-        {
-            PERROR("Could not open the initial ramdisk image");
-            goto error_out;
-        }
-
-        initrd_info.len = xc_get_filesz(fd);
-        if ( (initrd_info.u.file_handle = gzdopen(fd, "rb")) == NULL )
-        {
-            PERROR("Could not allocate decompression state for initrd");
-            goto error_out;
-        }
+        initrd_info.u.fd = fd;
+        initrd_info.len  = lseek(fd, 0, SEEK_END);
+        lseek(fd, 0, SEEK_SET);
     }
 
     sts = xc_linux_build_internal(xc_handle, domid, image, image_size,
@@ -1367,8 +1363,8 @@ int xc_linux_build(int xc_handle,
 
  error_out:
     free(image);
-    if ( initrd_info.type == INITRD_file && initrd_info.u.file_handle )
-        gzclose(initrd_info.u.file_handle);
+    if ( initrd_info.type == INITRD_file )
+        close(initrd_info.u.fd);
     else if ( fd >= 0 )
         close(fd);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEND] No need to decompress the initrd when building a domain., Xen patchbot-unstable <=