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 5 of 6] libxl: use libxl_domain_type enum with libxl_

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 5 of 6] libxl: use libxl_domain_type enum with libxl__domain_suspend_common
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Mon, 18 Jul 2011 10:06:32 +0100
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Mon, 18 Jul 2011 02:14:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1310979987@xxxxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1310979987@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1310979573 -3600
# Node ID 6bd6decb4f8760cc5f2fb47fef27de522fbc8c8a
# Parent  66815389db5e368e1f5980f833e01965d45cf7bb
libxl: use libxl_domain_type enum with libxl__domain_suspend_common

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 66815389db5e -r 6bd6decb4f87 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jul 18 09:59:33 2011 +0100
+++ b/tools/libxl/libxl.c       Mon Jul 18 09:59:33 2011 +0100
@@ -474,13 +474,13 @@ int libxl_domain_suspend(libxl_ctx *ctx,
                          uint32_t domid, int fd)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    int hvm = LIBXL__DOMAIN_IS_TYPE(&gc,  domid, HVM);
+    libxl_domain_type type = libxl__domain_type(&gc, domid);
     int live = info != NULL && info->flags & XL_SUSPEND_LIVE;
     int debug = info != NULL && info->flags & XL_SUSPEND_DEBUG;
     int rc = 0;
 
-    rc = libxl__domain_suspend_common(&gc, domid, fd, hvm, live, debug);
-    if (!rc && hvm)
+    rc = libxl__domain_suspend_common(&gc, domid, fd, type, live, debug);
+    if (!rc && type == LIBXL_DOMAIN_TYPE_HVM)
         rc = libxl__domain_save_device_model(&gc, domid, fd);
     libxl__free_all(&gc);
     return rc;
diff -r 66815389db5e -r 6bd6decb4f87 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Mon Jul 18 09:59:33 2011 +0100
+++ b/tools/libxl/libxl_dom.c   Mon Jul 18 09:59:33 2011 +0100
@@ -513,14 +513,26 @@ static int libxl__domain_suspend_common_
 }
 
 int libxl__domain_suspend_common(libxl__gc *gc, uint32_t domid, int fd,
-               int hvm, int live, int debug)
+                                 libxl_domain_type type,
+                                 int live, int debug)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int flags;
     int port;
     struct save_callbacks callbacks;
     struct suspendinfo si;
-    int rc = ERROR_FAIL;
+    int hvm, rc = ERROR_FAIL;
+
+    switch (type) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        hvm = 1;
+        break;
+    case LIBXL_DOMAIN_TYPE_PV:
+        hvm = 0;
+        break;
+    default:
+        return ERROR_INVAL;
+    }
 
     flags = (live) ? XCFLAGS_LIVE : 0
           | (debug) ? XCFLAGS_DEBUG : 0
diff -r 66815389db5e -r 6bd6decb4f87 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Jul 18 09:59:33 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Mon Jul 18 09:59:33 2011 +0100
@@ -200,7 +200,9 @@ _hidden int libxl__domain_restore_common
                                          libxl_domain_build_info *info,
                                          libxl__domain_build_state *state,
                                          int fd);
-_hidden int libxl__domain_suspend_common(libxl__gc *gc, uint32_t domid, int 
fd, int hvm, int live, int debug);
+_hidden int libxl__domain_suspend_common(libxl__gc *gc, uint32_t domid, int fd,
+                                         libxl_domain_type type,
+                                         int live, int debug);
 _hidden int libxl__domain_save_device_model(libxl__gc *gc, uint32_t domid, int 
fd);
 _hidden void libxl__userdata_destroyall(libxl__gc *gc, uint32_t domid);
 

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

<Prev in Thread] Current Thread [Next in Thread>