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] xc_save/xc_restore open the libxc

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] xc_save/xc_restore open the libxc interface independently
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2006 20:30:32 +0000
Delivery-date: Tue, 15 Aug 2006 13:34:47 -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 bb37d167c82e2501229d07d014b7c1b4633acc9b
# Parent  d20e1835c24b8a5051b6e8996d1387ee25a88ffd
[XEND] xc_save/xc_restore open the libxc interface independently
of their parent. This is required now that the interface fd is
marked for close-on-exec.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendCheckpoint.py |    4 ++--
 tools/xcutils/xc_restore.c              |   23 +++++++++++++++--------
 tools/xcutils/xc_save.c                 |   28 ++++++++++++++++++----------
 3 files changed, 35 insertions(+), 20 deletions(-)

diff -r d20e1835c24b -r bb37d167c82e tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Tue Aug 15 18:20:03 2006 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py   Tue Aug 15 19:04:43 2006 +0100
@@ -78,7 +78,7 @@ def save(fd, dominfo, network, live, dst
         # enabled. Passing "0" simply uses the defaults compiled into
         # libxenguest; see the comments and/or code in xc_linux_save() for
         # more information.
-        cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(xc.handle()), str(fd),
+        cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd),
                str(dominfo.getDomid()), "0", "0", str(int(live)) ]
         log.debug("[xc_save]: %s", string.join(cmd))
 
@@ -150,7 +150,7 @@ def restore(xd, fd):
         balloon.free(xc.pages_to_kib(nr_pfns))
 
         cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
-                        xc.handle(), fd, dominfo.getDomid(), nr_pfns,
+                        fd, dominfo.getDomid(), nr_pfns,
                         store_port, console_port])
         log.debug("[xc_restore]: %s", string.join(cmd))
 
diff -r d20e1835c24b -r bb37d167c82e tools/xcutils/xc_restore.c
--- a/tools/xcutils/xc_restore.c        Tue Aug 15 18:20:03 2006 +0100
+++ b/tools/xcutils/xc_restore.c        Tue Aug 15 19:04:43 2006 +0100
@@ -12,6 +12,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <xenctrl.h>
 #include <xenguest.h>
 
 int
@@ -21,17 +22,20 @@ main(int argc, char **argv)
     int ret;
     unsigned long store_mfn, console_mfn;
 
-    if (argc != 7)
+    if (argc != 6)
        errx(1,
-            "usage: %s xcfd iofd domid nr_pfns store_evtchn console_evtchn",
+            "usage: %s iofd domid nr_pfns store_evtchn console_evtchn",
             argv[0]);
 
-    xc_fd = atoi(argv[1]);
-    io_fd = atoi(argv[2]);
-    domid = atoi(argv[3]);
-    nr_pfns = atoi(argv[4]);
-    store_evtchn = atoi(argv[5]);
-    console_evtchn = atoi(argv[6]);
+    xc_fd = xc_interface_open();
+    if (xc_fd < 0)
+        errx(1, "failed to open control interface");
+
+    io_fd = atoi(argv[1]);
+    domid = atoi(argv[2]);
+    nr_pfns = atoi(argv[3]);
+    store_evtchn = atoi(argv[4]);
+    console_evtchn = atoi(argv[5]);
 
     ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, store_evtchn,
                           &store_mfn, console_evtchn, &console_mfn);
@@ -40,5 +44,8 @@ main(int argc, char **argv)
        printf("console-mfn %li\n", console_mfn);
        fflush(stdout);
     }
+
+    xc_interface_close(xc_fd);
+
     return ret;
 }
diff -r d20e1835c24b -r bb37d167c82e tools/xcutils/xc_save.c
--- a/tools/xcutils/xc_save.c   Tue Aug 15 18:20:03 2006 +0100
+++ b/tools/xcutils/xc_save.c   Tue Aug 15 19:04:43 2006 +0100
@@ -13,8 +13,8 @@
 #include <string.h>
 #include <stdio.h>
 
+#include <xenctrl.h>
 #include <xenguest.h>
-
 
 /**
  * Issue a suspend request through stdout, and receive the acknowledgement
@@ -36,16 +36,24 @@ main(int argc, char **argv)
 main(int argc, char **argv)
 {
     unsigned int xc_fd, io_fd, domid, maxit, max_f, flags; 
+    int ret;
 
-    if (argc != 7)
-       errx(1, "usage: %s xcfd iofd domid maxit maxf flags", argv[0]);
+    if (argc != 6)
+       errx(1, "usage: %s iofd domid maxit maxf flags", argv[0]);
 
-    xc_fd = atoi(argv[1]);
-    io_fd = atoi(argv[2]);
-    domid = atoi(argv[3]);
-    maxit = atoi(argv[4]);
-    max_f = atoi(argv[5]);
-    flags = atoi(argv[6]);
+    xc_fd = xc_interface_open();
+    if (xc_fd < 0)
+        errx(1, "failed to open control interface");
 
-    return xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags, &suspend);
+    io_fd = atoi(argv[1]);
+    domid = atoi(argv[2]);
+    maxit = atoi(argv[3]);
+    max_f = atoi(argv[4]);
+    flags = atoi(argv[5]);
+
+    ret = xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags, &suspend);
+
+    xc_interface_close(xc_fd);
+
+    return ret;
 }

_______________________________________________
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] xc_save/xc_restore open the libxc interface independently, Xen patchbot-unstable <=