xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Wei Liu" <wei.liu2@citrix.com>,
	"Changlong Xie" <xiecl.fnst@cn.fujitsu.com>,
	"Ian Jackson" <Ian.Jackson@eu.citrix.com>,
	"Wen Congyang" <wency@cn.fujitsu.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 1/3] libxl: colo: rearrange things in header files
Date: Tue, 5 Apr 2016 21:06:00 +0100	[thread overview]
Message-ID: <1459886762-8815-2-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1459886762-8815-1-git-send-email-wei.liu2@citrix.com>

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>
---
 tools/libxl/libxl_colo.h     | 40 +++++++++++++++++++++++++---------------
 tools/libxl/libxl_internal.h | 36 ++++++++++++------------------------
 2 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h
index 30fd1dc..4f6a612 100644
--- a/tools/libxl/libxl_colo.h
+++ b/tools/libxl/libxl_colo.h
@@ -16,13 +16,9 @@
 #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);
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7df2711..0107298 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -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.
@@ -3134,6 +3143,7 @@ libxl__stream_read_inuse(const libxl__stream_read_state *stream)
     return stream->running;
 }
 
+#include "libxl_colo.h"
 
 /*----- Domain suspend (save) state structure -----*/
 /*
@@ -3210,28 +3220,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;
-- 
2.1.4


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

  reply	other threads:[~2016-04-05 20:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
2016-04-05 20:06 ` Wei Liu [this message]
2016-04-06 13:41   ` [PATCH 1/3] libxl: colo: rearrange things in header files Ian Jackson
2016-04-05 20:06 ` [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c Wei Liu
2016-04-06 13:41   ` Ian Jackson
2016-04-05 20:06 ` [PATCH 3/3] libxl: colo: only build COLO on Linux Wei Liu
2016-04-06 10:24   ` Wei Liu
2016-04-06  1:24 ` [PATCH 0/3] COLO: only build " Wen Congyang
2016-04-06 10:17   ` Wei Liu
2016-04-06 10:20     ` Wen Congyang
2016-04-06 10:22       ` Wei Liu
2016-04-06  6:19 ` Changlong Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459886762-8815-2-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xiecl.fnst@cn.fujitsu.com \
    --subject='Re: [PATCH 1/3] libxl: colo: rearrange things in header files' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).