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

[Xen-devel] [PATCH V9 06/12] remus: implement the API for checkpoint



---
 tools/libxl/libxl_internal.h     |  3 +++
 tools/libxl/libxl_remus_device.c | 54 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 421ae24..14094aa 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2485,6 +2485,9 @@ _hidden void libxl__remus_teardown_done(libxl__egc *egc,
 
 _hidden void libxl__remus_device_teardown(libxl__egc *egc,
                                           libxl__domain_suspend_state *dss);
+_hidden int libxl__remus_device_postsuspend(libxl__remus_state *remus_state);
+_hidden int libxl__remus_device_preresume(libxl__remus_state *remus_state);
+_hidden int libxl__remus_device_commit(libxl__remus_state *remus_state);
 
 struct libxl__domain_suspend_state {
     /* set by caller of libxl__domain_suspend */
diff --git a/tools/libxl/libxl_remus_device.c b/tools/libxl/libxl_remus_device.c
index 6e7d0d5..bfe6080 100644
--- a/tools/libxl/libxl_remus_device.c
+++ b/tools/libxl/libxl_remus_device.c
@@ -39,6 +39,60 @@ typedef struct libxl__remus_device_state {
 static libxl__remus_device_type *device_types[] = {
 };
 
+int libxl__remus_device_postsuspend(libxl__remus_state *remus_state)
+{
+    int i;
+    int rc = 0;
+    libxl__remus_device *remus_dev;
+
+    /* Convenience aliases */
+    libxl__remus_device_state *dev_state = remus_state->device_state;
+
+    for (i = 0; rc == 0 && i < dev_state->num_devices; i++) {
+        remus_dev = dev_state->dev[i];
+        if (remus_dev->dev_type->postsuspend)
+            rc = remus_dev->dev_type->postsuspend(remus_dev);
+    }
+
+    return rc;
+}
+
+int libxl__remus_device_preresume(libxl__remus_state *remus_state)
+{
+    int i;
+    int rc = 0;
+    libxl__remus_device *remus_dev;
+
+    /* Convenience aliases */
+    libxl__remus_device_state *dev_state = remus_state->device_state;
+
+    for (i = 0; rc == 0 && i < dev_state->num_devices; i++) {
+        remus_dev = dev_state->dev[i];
+        if (remus_dev->dev_type->preresume)
+            rc = remus_dev->dev_type->preresume(remus_dev);
+    }
+
+    return rc;
+}
+
+int libxl__remus_device_commit(libxl__remus_state *remus_state)
+{
+    int i;
+    int rc = 0;
+    libxl__remus_device *remus_dev;
+
+    /* Convenience aliases */
+    libxl__remus_device_state *dev_state = remus_state->device_state;
+
+    for (i = 0; rc == 0 && i < dev_state->num_devices; i++) {
+        remus_dev = dev_state->dev[i];
+        if (remus_dev->dev_type->commit)
+            rc = remus_dev->dev_type->commit(remus_dev);
+    }
+
+    return rc;
+}
+
 static void init_async_exec(libxl__remus_device_state *dev_state,
                             void (*finish_cb)(void *opaque, int status))
 {
-- 
1.8.3.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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