Skip to contentSkip to conversation

libxc: move migration_stream's definition to xenguest.h

PATCH Superseded Wen Congyang 3 participants 5 messages Mar 9, 2016 – Mar 10, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 libxc: move migration_stream's definition to xenguest.h

xc_domain_save() and xc_domain_restore's parameter will use this type, so it should be public.

---
 tools/libxc/include/xenguest.h |  5 +++++
 tools/libxc/xc_sr_common.h     | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)
tools/libxc/include/xenguest.h +5 -0
index affc42b..973e5a6 100644
@@ -75,6 +75,11 @@ struct save_callbacks {
     void* data;
 };
 
+typedef enum {
+    MIG_STREAM_NONE, /* plain stream */
+    MIG_STREAM_REMUS,
+} xc_migration_stream_t;
+
 /**
  * This function will save a running domain.
  *
tools/libxc/xc_sr_common.h +0 -10
index 66f595f..e7568b5 100644
@@ -180,16 +180,6 @@ struct xc_sr_context
 
     xc_dominfo_t dominfo;
 
-    /*
-     * migration stream
-     * 0: Plain VM
-     * 1: Remus
-     */
-    enum {
-        MIG_STREAM_NONE, /* plain stream */
-        MIG_STREAM_REMUS,
-    } migration_stream;
-
     union /* Common save or restore data. */
     {
         struct /* Save data. */
Signature · 9 lines
2.5.0




_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

PATCH v2 2/2 tools: change checkpointed_stream's type from int to xc_migration_stream_t

---
 tools/libxc/include/xenguest.h  |  4 ++--
 tools/libxc/xc_nomigrate.c      |  4 ++--
 tools/libxc/xc_sr_restore.c     |  2 +-
 tools/libxc/xc_sr_save.c        |  2 +-
 tools/libxl/libxl_save_helper.c | 38 +++++++++++++++++++-------------------
 5 files changed, 25 insertions(+), 25 deletions(-)
tools/libxc/include/xenguest.h +2 -2
index 973e5a6..029082d 100644
@@ -93,7 +93,7 @@ typedef enum {
 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
                    uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
                    struct save_callbacks* callbacks, int hvm,
-                   int checkpointed_stream);
+                   xc_migration_stream_t checkpointed_stream);
 
 /* callbacks provided by xc_domain_restore */
 struct restore_callbacks {
@@ -131,7 +131,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       domid_t store_domid, unsigned int console_evtchn,
                       unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
-                      int checkpointed_stream,
+                      xc_migration_stream_t checkpointed_stream,
                       struct restore_callbacks *callbacks);
 
 /**
tools/libxc/xc_nomigrate.c +2 -2
index c9124df..77db59c 100644
@@ -23,7 +23,7 @@
 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
                    uint32_t max_factor, uint32_t flags,
                    struct save_callbacks* callbacks, int hvm,
-                   int checkpointed_stream)
+                   xc_migration_stream_t checkpointed_stream)
 {
     errno = ENOSYS;
     return -1;
@@ -34,7 +34,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       domid_t store_domid, unsigned int console_evtchn,
                       unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
-                      int checkpointed_stream,
+                      xc_migration_stream_t checkpointed_stream,
                       struct restore_callbacks *callbacks)
 {
     errno = ENOSYS;
tools/libxc/xc_sr_restore.c +1 -1
index d4d33fd..b2a3558 100644
@@ -725,7 +725,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       domid_t store_domid, unsigned int console_evtchn,
                       unsigned long *console_gfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
-                      int checkpointed_stream,
+                      xc_migration_stream_t checkpointed_stream,
                       struct restore_callbacks *callbacks)
 {
     struct xc_sr_context ctx =
tools/libxc/xc_sr_save.c +1 -1
index e258b7c..fc51f60 100644
@@ -830,7 +830,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)
 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
                    uint32_t max_iters, uint32_t max_factor, uint32_t flags,
                    struct save_callbacks* callbacks, int hvm,
-                   int checkpointed_stream)
+                   xc_migration_stream_t checkpointed_stream)
 {
     struct xc_sr_context ctx =
         {
tools/libxl/libxl_save_helper.c +19 -19
index 6bdcf13..5503311 100644
@@ -246,14 +246,14 @@ int main(int argc, char **argv)
 
     if (!strcmp(mode,"--save-domain")) {
 
-        io_fd =                    atoi(NEXTARG);
-        uint32_t dom =             strtoul(NEXTARG,0,10);
-        uint32_t max_iters =       strtoul(NEXTARG,0,10);
-        uint32_t max_factor =      strtoul(NEXTARG,0,10);
-        uint32_t flags =           strtoul(NEXTARG,0,10);
-        int hvm =                  atoi(NEXTARG);
-        unsigned cbflags =         strtoul(NEXTARG,0,10);
-        int checkpointed_stream =  strtoul(NEXTARG,0,10);
+        io_fd =                                     atoi(NEXTARG);
+        uint32_t dom =                              strtoul(NEXTARG,0,10);
+        uint32_t max_iters =                        strtoul(NEXTARG,0,10);
+        uint32_t max_factor =                       strtoul(NEXTARG,0,10);
+        uint32_t flags =                            strtoul(NEXTARG,0,10);
+        int hvm =                                   atoi(NEXTARG);
+        unsigned cbflags =                          strtoul(NEXTARG,0,10);
+        xc_migration_stream_t checkpointed_stream = strtoul(NEXTARG,0,10);
         assert(!*++argv);
 
         helper_setcallbacks_save(&helper_save_callbacks, cbflags);
@@ -267,17 +267,17 @@ int main(int argc, char **argv)
 
     } else if (!strcmp(mode,"--restore-domain")) {
 
-        io_fd =                    atoi(NEXTARG);
-        uint32_t dom =             strtoul(NEXTARG,0,10);
-        unsigned store_evtchn =    strtoul(NEXTARG,0,10);
-        domid_t store_domid =      strtoul(NEXTARG,0,10);
-        unsigned console_evtchn =  strtoul(NEXTARG,0,10);
-        domid_t console_domid =    strtoul(NEXTARG,0,10);
-        unsigned int hvm =         strtoul(NEXTARG,0,10);
-        unsigned int pae =         strtoul(NEXTARG,0,10);
-        int superpages =           strtoul(NEXTARG,0,10);
-        unsigned cbflags =         strtoul(NEXTARG,0,10);
-        int checkpointed =         strtoul(NEXTARG,0,10);
+        io_fd =                                 atoi(NEXTARG);
+        uint32_t dom =                          strtoul(NEXTARG,0,10);
+        unsigned store_evtchn =                 strtoul(NEXTARG,0,10);
+        domid_t store_domid =                   strtoul(NEXTARG,0,10);
+        unsigned console_evtchn =               strtoul(NEXTARG,0,10);
+        domid_t console_domid =                 strtoul(NEXTARG,0,10);
+        unsigned int hvm =                      strtoul(NEXTARG,0,10);
+        unsigned int pae =                      strtoul(NEXTARG,0,10);
+        int superpages =                        strtoul(NEXTARG,0,10);
+        unsigned cbflags =                      strtoul(NEXTARG,0,10);
+        xc_migration_stream_t checkpointed =    strtoul(NEXTARG,0,10);
         assert(!*++argv);
 
         helper_setcallbacks_restore(&helper_restore_callbacks, cbflags);
Signature · 9 lines
2.5.0




_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

Re: [PATCH v2 2/2] tools: change checkpointed_stream's type from int to xc_migration_stream_t

In reply to Wen Congyang
Quoted 14 lines · Wen Congyang
---
 tools/libxc/include/xenguest.h  |  4 ++--
 tools/libxc/xc_nomigrate.c      |  4 ++--
 tools/libxc/xc_sr_restore.c     |  2 +-
 tools/libxc/xc_sr_save.c        |  2 +-
 tools/libxl/libxl_save_helper.c | 38 +++++++++++++++++++-------------------
 5 files changed, 25 insertions(+), 25 deletions(-)
tools/libxc/include/xenguest.h +0 -0
index 973e5a6..029082d 100644

tools/libxc/include/xenguest.h typedef enum { · line 96

Quoted 5 lines
tools/libxc/include/xenguest.h +1 -1
@@ -93,7 +93,7 @@ typedef enum {
 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
                    uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
                    struct save_callbacks* callbacks, int hvm,
-                   int checkpointed_stream);
+                   xc_migration_stream_t checkpointed_stream);

s/checkpointed_stream/stream_type/

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
In reply to Wen Congyang
Quoted 14 lines · Wen Congyang

xc_domain_save() and xc_domain_restore's parameter will use this type, so it should be public.

---
 tools/libxc/include/xenguest.h |  5 +++++
 tools/libxc/xc_sr_common.h     | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)
tools/libxc/include/xenguest.h +0 -0
index affc42b..973e5a6 100644

tools/libxc/include/xenguest.h struct save_callbacks { · line 80

Quoted 6 lines
tools/libxc/include/xenguest.h +3 -0
@@ -75,6 +75,11 @@ struct save_callbacks {
     void* data;
 };
 
+typedef enum {
+    MIG_STREAM_NONE, /* plain stream */
+    MIG_STREAM_REMUS,

You also need to make them have XC_ prefix.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel