[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/4] HVM save/restore clean up: change max_pfn format



[PATCH 3/4] HVM save/restore clean up: change max_pfn format

Signed-off-by: Zhai Edwin <edwin.zhai@xxxxxxxxx>

change from unsigned long to int for 32 guest saved on 64 and restore on 32 in 
future.
seems 2^32 pages is big enough.

diff -r f6912b819d3c tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Fri Jan 19 19:39:12 2007 +0800
@@ -223,7 +223,7 @@ xc_linux_save(int xc_handle, int io_fd, 
     }
 
     /* This is expected by xm restore.  */
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/libxc/xc_hvm_save.c
--- a/tools/libxc/xc_hvm_save.c Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/xc_hvm_save.c Fri Jan 19 19:39:12 2007 +0800
@@ -468,7 +468,7 @@ int xc_hvm_save(int xc_handle, int io_fd
     }
 
     /* Start writing out the saved-domain record. */
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/xc_linux_save.c       Fri Jan 19 19:39:12 2007 +0800
@@ -822,7 +822,7 @@ int xc_linux_save(int xc_handle, int io_
 
     /* Start writing out the saved-domain record. */
 
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/python/xen/xend/XendCheckpoint.py   Fri Jan 19 19:40:06 2007 +0800
@@ -189,24 +189,19 @@ def restore(xd, fd, dominfo = None, paus
                  dominfo.domid, hvm, apic, pae)
 
     try:
-        if hvm:
-            l = read_exact(fd, sizeof_unsigned_int,
-                           "not a valid hvm guest state file: pfn count read")
-            nr_pfns = unpack("I", l)[0]    # native sizeof int
-        else: 
-            l = read_exact(fd, sizeof_unsigned_long,
-                           "not a valid guest state file: pfn count read")
-
-        max_pfn = unpack("L", l)[0]    # native sizeof long
+        l = read_exact(fd, sizeof_unsigned_int,
+                       "not a valid hvm guest state file: pfn count read")
+        max_pfn = unpack("I", l)[0]    # native sizeof int
+
         if max_pfn > 16*1024*1024:     # XXX 
             raise XendError(
                 "not a valid guest state file: pfn count out of range")
 
         shadow = dominfo.info['shadow_memory']
         log.debug("restore:shadow=0x%x, _static_max=0x%x, _static_min=0x%x, "
-                  "nr_pfns=0x%x.", dominfo.info['shadow_memory'],
+                  "nr_pfns=0x%x, max_pfn=0x%x.", dominfo.info['shadow_memory'],
                   dominfo.info['memory_static_max'],
-                  dominfo.info['memory_static_min'], nr_pfns)
+                  dominfo.info['memory_static_min'], nr_pfns, max_pfn)
 
 
         balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.