@@ -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);
@@ -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;
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(-)