]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: colo: rearrange things in header files
authorWei Liu <wei.liu2@citrix.com>
Tue, 5 Apr 2016 18:15:49 +0000 (19:15 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 6 Apr 2016 14:10:10 +0000 (15:10 +0100)
We need to separate COLO code from common code as clean as possible.
With this patch, all COLO structures are now in libxl_colo.h.

It does the following:
1. Move two typedefs for libxl__domain_create_state{,cb} back to
   libxl_internal.h.
2. Move libxl__colo_save_state to libxl_colo.h.
3. Include libxl_internal.h in libxl_colo.h.
4. Move a bunch of colo typedefs to the top of libxl_internal.h.
5. Move the inclusion of libxl_colo.h to the right place in
   libxl_internal.h.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_colo.h
tools/libxl/libxl_internal.h

index 30fd1dc450e8e40965eb539a5a0b538cd588de79..4f6a612f53a91ac1cfb0665156080b9029c7aa7b 100644 (file)
 #ifndef LIBXL_COLO_H
 #define LIBXL_COLO_H
 
+#include "libxl_internal.h"
 #include <linux/netlink.h>
 
-struct libxl__ao;
-struct libxl__egc;
-struct libxl__colo_save_state;
-struct libxl__checkpoint_devices_state;
-
 /* Consistent with the new COLO netlink channel in kernel side */
 #define NETLINK_COLO 28
 
@@ -65,16 +61,15 @@ enum colo_netlink_op {
     COLO_PROXY_RESET, /* UNUSED, will be used for continuous FT */
 };
 
-typedef struct libxl__colo_device_nic {
+struct libxl__colo_device_nic {
     int devid;
     const char *vif;
-} libxl__colo_device_nic;
+};
 
-typedef struct libxl__colo_qdisk {
+struct libxl__colo_qdisk {
     bool setuped;
-} libxl__colo_qdisk;
+};
 
-typedef struct libxl__colo_proxy_state libxl__colo_proxy_state;
 struct libxl__colo_proxy_state {
     /* set by caller of colo_proxy_setup */
     struct libxl__ao *ao;
@@ -83,12 +78,27 @@ struct libxl__colo_proxy_state {
     int index;
 };
 
-typedef struct libxl__domain_create_state libxl__domain_create_state;
-typedef void libxl__domain_create_cb(struct libxl__egc *egc,
-                                     libxl__domain_create_state *dcs,
-                                     int rc, uint32_t domid);
+struct libxl__colo_save_state {
+    int send_fd;
+    int recv_fd;
+    char *colo_proxy_script;
+
+    /* private */
+    libxl__stream_read_state srs;
+    void (*callback)(libxl__egc *, libxl__colo_save_state *, int);
+    bool svm_running;
+    bool paused;
+
+    /* private, used by qdisk block replication */
+    bool qdisk_used;
+    bool qdisk_setuped;
+
+    /* private, used by colo-proxy */
+    libxl__colo_proxy_state cps;
+    libxl__ev_child child;
+};
+
 
-typedef struct libxl__colo_restore_state libxl__colo_restore_state;
 typedef void libxl__colo_callback(struct libxl__egc *egc,
                                   libxl__colo_restore_state *crs, int rc);
 
index fb4d225944d38d09c234ccbffe7b5b46986b6016..c2014261148c8b505df846294325cf88ba19182c 100644 (file)
@@ -87,8 +87,6 @@
 #include "_libxl_types_internal.h"
 #include "_libxl_types_internal_json.h"
 
-#include "libxl_colo.h"
-
 #define LIBXL_INIT_TIMEOUT 10
 #define LIBXL_DESTROY_TIMEOUT 10
 #define LIBXL_HOTPLUG_TIMEOUT 40
@@ -184,6 +182,17 @@ typedef struct libxl__aop_occurred libxl__aop_occurred;
 typedef struct libxl__osevent_hook_nexus libxl__osevent_hook_nexus;
 typedef struct libxl__osevent_hook_nexi libxl__osevent_hook_nexi;
 
+typedef struct libxl__domain_create_state libxl__domain_create_state;
+typedef void libxl__domain_create_cb(struct libxl__egc *egc,
+                                     libxl__domain_create_state *dcs,
+                                     int rc, uint32_t domid);
+
+typedef struct libxl__colo_device_nic libxl__colo_device_nic;
+typedef struct libxl__colo_qdisk libxl__colo_qdisk;
+typedef struct libxl__colo_proxy_state libxl__colo_proxy_state;
+typedef struct libxl__colo_save_state libxl__colo_save_state;
+typedef struct libxl__colo_restore_state libxl__colo_restore_state;
+
 _hidden void libxl__alloc_failed(libxl_ctx *, const char *func,
                          size_t nmemb, size_t size) __attribute__((noreturn));
   /* func, size and nmemb are used only in the log message.
@@ -3141,6 +3150,7 @@ libxl__stream_read_inuse(const libxl__stream_read_state *stream)
     return stream->running;
 }
 
+#include "libxl_colo.h"
 
 /*----- Domain suspend (save) state structure -----*/
 /*
@@ -3217,28 +3227,6 @@ libxl__stream_write_inuse(const libxl__stream_write_state *stream)
     return stream->running;
 }
 
-/*----- colo related state structure -----*/
-typedef struct libxl__colo_save_state libxl__colo_save_state;
-struct libxl__colo_save_state {
-    int send_fd;
-    int recv_fd;
-    char *colo_proxy_script;
-
-    /* private */
-    libxl__stream_read_state srs;
-    void (*callback)(libxl__egc *, libxl__colo_save_state *, int);
-    bool svm_running;
-    bool paused;
-
-    /* private, used by qdisk block replication */
-    bool qdisk_used;
-    bool qdisk_setuped;
-
-    /* private, used by colo-proxy */
-    libxl__colo_proxy_state cps;
-    libxl__ev_child child;
-};
-
 typedef struct libxl__logdirty_switch {
     /* Set by caller of libxl__domain_common_switch_qemu_logdirty */
     libxl__ao *ao;