@@ -32,17 +32,17 @@
do { } while (0)
#endif
-static int file_errno(FdMigrationState *s)
+static int file_errno(MigrationState *s)
{
return errno;
}
-static int file_write(FdMigrationState *s, const void * buf, size_t size)
+static int file_write(MigrationState *s, const void * buf, size_t size)
{
return write(s->fd, buf, size);
}
-static int exec_close(FdMigrationState *s, bool flush)
+static int exec_close(MigrationState *s, bool flush)
{
int ret = 0;
DPRINTF("exec_close\n");
@@ -61,14 +61,14 @@ static int exec_close(FdMigrationState *s, bool flush)
return ret;
}
-FdMigrationState *exec_start_outgoing_migration(Monitor *mon,
+MigrationState *exec_start_outgoing_migration(Monitor *mon,
const char *command,
int64_t bandwidth_limit,
int detach,
int blk,
int inc)
{
- FdMigrationState *s;
+ MigrationState *s;
FILE *f;
s = g_malloc0(sizeof(*s));
@@ -30,17 +30,17 @@
do { } while (0)
#endif
-static int fd_errno(FdMigrationState *s)
+static int fd_errno(MigrationState *s)
{
return errno;
}
-static int fd_write(FdMigrationState *s, const void * buf, size_t size)
+static int fd_write(MigrationState *s, const void * buf, size_t size)
{
return write(s->fd, buf, size);
}
-static int fd_close(FdMigrationState *s, bool flush)
+static int fd_close(MigrationState *s, bool flush)
{
DPRINTF("fd_close\n");
if (s->fd != -1) {
@@ -50,14 +50,14 @@ static int fd_close(FdMigrationState *s, bool flush)
return 0;
}
-FdMigrationState *fd_start_outgoing_migration(Monitor *mon,
+MigrationState *fd_start_outgoing_migration(Monitor *mon,
const char *fdname,
int64_t bandwidth_limit,
int detach,
int blk,
int inc)
{
- FdMigrationState *s;
+ MigrationState *s;
s = g_malloc0(sizeof(*s));
@@ -28,17 +28,17 @@
do { } while (0)
#endif
-static int socket_errno(FdMigrationState *s)
+static int socket_errno(MigrationState *s)
{
return socket_error();
}
-static int socket_write(FdMigrationState *s, const void * buf, size_t size)
+static int socket_write(MigrationState *s, const void * buf, size_t size)
{
return send(s->fd, buf, size, 0);
}
-static int tcp_close(FdMigrationState *s, bool flush)
+static int tcp_close(MigrationState *s, bool flush)
{
DPRINTF("tcp_close\n");
if (s->fd != -1) {
@@ -51,7 +51,7 @@ static int tcp_close(FdMigrationState *s, bool flush)
static void tcp_wait_for_connect(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int val, ret;
socklen_t valsize = sizeof(val);
@@ -75,7 +75,7 @@ static void tcp_wait_for_connect(void *opaque)
}
}
-FdMigrationState *tcp_start_outgoing_migration(Monitor *mon,
+MigrationState *tcp_start_outgoing_migration(Monitor *mon,
const char *host_port,
int64_t bandwidth_limit,
int detach,
@@ -83,7 +83,7 @@ FdMigrationState *tcp_start_outgoing_migration(Monitor *mon,
int inc)
{
struct sockaddr_in addr;
- FdMigrationState *s;
+ MigrationState *s;
int ret;
if (parse_host_port(&addr, host_port) < 0)
@@ -28,17 +28,17 @@
do { } while (0)
#endif
-static int unix_errno(FdMigrationState *s)
+static int unix_errno(MigrationState *s)
{
return errno;
}
-static int unix_write(FdMigrationState *s, const void * buf, size_t size)
+static int unix_write(MigrationState *s, const void * buf, size_t size)
{
return write(s->fd, buf, size);
}
-static int unix_close(FdMigrationState *s, bool flush)
+static int unix_close(MigrationState *s, bool flush)
{
DPRINTF("unix_close\n");
if (s->fd != -1) {
@@ -50,7 +50,7 @@ static int unix_close(FdMigrationState *s, bool flush)
static void unix_wait_for_connect(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int val, ret;
socklen_t valsize = sizeof(val);
@@ -74,14 +74,14 @@ static void unix_wait_for_connect(void *opaque)
}
}
-FdMigrationState *unix_start_outgoing_migration(Monitor *mon,
+MigrationState *unix_start_outgoing_migration(Monitor *mon,
const char *path,
int64_t bandwidth_limit,
int detach,
int blk,
int inc)
{
- FdMigrationState *s;
+ MigrationState *s;
struct sockaddr_un addr;
int ret;
@@ -34,7 +34,7 @@
/* Migration speed throttling */
static int64_t max_throttle = (32 << 20);
-static FdMigrationState *current_migration;
+static MigrationState *current_migration;
static NotifierList migration_state_notifiers =
NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
@@ -78,7 +78,7 @@ void process_incoming_migration(QEMUFile *f)
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- FdMigrationState *s = NULL;
+ MigrationState *s = NULL;
const char *p;
int detach = qdict_get_try_bool(qdict, "detach", 0);
int blk = qdict_get_try_bool(qdict, "blk", 0);
@@ -130,7 +130,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- FdMigrationState *s = current_migration;
+ MigrationState *s = current_migration;
if (s && s->get_status(s) == MIG_STATE_ACTIVE) {
s->cancel(s);
@@ -141,7 +141,7 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
int64_t d;
- FdMigrationState *s;
+ MigrationState *s;
d = qdict_get_int(qdict, "value");
if (d < 0) {
@@ -229,7 +229,7 @@ void do_info_migrate(Monitor *mon, QObject **ret_data)
QDict *qdict;
if (current_migration) {
- FdMigrationState *s = current_migration;
+ MigrationState *s = current_migration;
switch (s->get_status(current_migration)) {
case MIG_STATE_ACTIVE:
@@ -262,7 +262,7 @@ void do_info_migrate(Monitor *mon, QObject **ret_data)
/* shared migration helpers */
-void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon)
+void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon)
{
s->mon = mon;
if (monitor_suspend(mon) == 0) {
@@ -273,7 +273,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon)
}
}
-void migrate_fd_error(FdMigrationState *s)
+void migrate_fd_error(MigrationState *s)
{
DPRINTF("setting error state\n");
s->state = MIG_STATE_ERROR;
@@ -281,7 +281,7 @@ void migrate_fd_error(FdMigrationState *s)
migrate_fd_cleanup(s);
}
-int migrate_fd_cleanup(FdMigrationState *s)
+int migrate_fd_cleanup(MigrationState *s)
{
int ret = 0;
@@ -309,7 +309,7 @@ int migrate_fd_cleanup(FdMigrationState *s)
void migrate_fd_put_notify(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
qemu_file_put_notify(s->file);
@@ -320,7 +320,7 @@ void migrate_fd_put_notify(void *opaque)
ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
ssize_t ret;
do {
@@ -337,7 +337,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
return ret;
}
-void migrate_fd_connect(FdMigrationState *s)
+void migrate_fd_connect(MigrationState *s)
{
int ret;
@@ -361,7 +361,7 @@ void migrate_fd_connect(FdMigrationState *s)
void migrate_fd_put_ready(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int ret;
if (s->state != MIG_STATE_ACTIVE) {
@@ -398,12 +398,12 @@ void migrate_fd_put_ready(void *opaque)
}
}
-int migrate_fd_get_status(FdMigrationState *s)
+int migrate_fd_get_status(MigrationState *s)
{
return s->state;
}
-void migrate_fd_cancel(FdMigrationState *s)
+void migrate_fd_cancel(MigrationState *s)
{
if (s->state != MIG_STATE_ACTIVE)
return;
@@ -417,7 +417,7 @@ void migrate_fd_cancel(FdMigrationState *s)
migrate_fd_cleanup(s);
}
-void migrate_fd_release(FdMigrationState *s)
+void migrate_fd_release(MigrationState *s)
{
DPRINTF("releasing state\n");
@@ -432,7 +432,7 @@ void migrate_fd_release(FdMigrationState *s)
void migrate_fd_wait_for_unfreeze(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int ret;
DPRINTF("wait for unfreeze\n");
@@ -451,7 +451,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque)
int migrate_fd_close(void *opaque, bool flush)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
if (s->mon) {
monitor_resume(s->mon);
@@ -23,21 +23,21 @@
#define MIG_STATE_CANCELLED 1
#define MIG_STATE_ACTIVE 2
-typedef struct FdMigrationState FdMigrationState;
+typedef struct MigrationState MigrationState;
-struct FdMigrationState
+struct MigrationState
{
int64_t bandwidth_limit;
QEMUFile *file;
int fd;
Monitor *mon;
int state;
- int (*get_error)(struct FdMigrationState*);
- int (*close)(struct FdMigrationState*, bool flush);
- int (*write)(struct FdMigrationState*, const void *, size_t);
- void (*cancel)(FdMigrationState *s);
- int (*get_status)(FdMigrationState *s);
- void (*release)(FdMigrationState *s);
+ int (*get_error)(MigrationState *s);
+ int (*close)(MigrationState *s, bool flush);
+ int (*write)(MigrationState *s, const void *buff, size_t size);
+ void (*cancel)(MigrationState *s);
+ int (*get_status)(MigrationState *s);
+ void (*release)(MigrationState *s);
void *opaque;
int blk;
int shared;
@@ -64,7 +64,7 @@ void do_info_migrate(Monitor *mon, QObject **ret_data);
int exec_start_incoming_migration(const char *host_port);
-FdMigrationState *exec_start_outgoing_migration(Monitor *mon,
+MigrationState *exec_start_outgoing_migration(Monitor *mon,
const char *host_port,
int64_t bandwidth_limit,
int detach,
@@ -73,7 +73,7 @@ FdMigrationState *exec_start_outgoing_migration(Monitor *mon,
int tcp_start_incoming_migration(const char *host_port);
-FdMigrationState *tcp_start_outgoing_migration(Monitor *mon,
+MigrationState *tcp_start_outgoing_migration(Monitor *mon,
const char *host_port,
int64_t bandwidth_limit,
int detach,
@@ -82,7 +82,7 @@ FdMigrationState *tcp_start_outgoing_migration(Monitor *mon,
int unix_start_incoming_migration(const char *path);
-FdMigrationState *unix_start_outgoing_migration(Monitor *mon,
+MigrationState *unix_start_outgoing_migration(Monitor *mon,
const char *path,
int64_t bandwidth_limit,
int detach,
@@ -91,32 +91,32 @@ FdMigrationState *unix_start_outgoing_migration(Monitor *mon,
int fd_start_incoming_migration(const char *path);
-FdMigrationState *fd_start_outgoing_migration(Monitor *mon,
+MigrationState *fd_start_outgoing_migration(Monitor *mon,
const char *fdname,
int64_t bandwidth_limit,
int detach,
int blk,
int inc);
-void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon);
+void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon);
-void migrate_fd_error(FdMigrationState *s);
+void migrate_fd_error(MigrationState *s);
-int migrate_fd_cleanup(FdMigrationState *s);
+int migrate_fd_cleanup(MigrationState *s);
void migrate_fd_put_notify(void *opaque);
ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size);
-void migrate_fd_connect(FdMigrationState *s);
+void migrate_fd_connect(MigrationState *s);
void migrate_fd_put_ready(void *opaque);
-int migrate_fd_get_status(FdMigrationState *mig_state);
+int migrate_fd_get_status(MigrationState *mig_state);
-void migrate_fd_cancel(FdMigrationState *mig_state);
+void migrate_fd_cancel(MigrationState *mig_state);
-void migrate_fd_release(FdMigrationState *mig_state);
+void migrate_fd_release(MigrationState *mig_state);
void migrate_fd_wait_for_unfreeze(void *opaque);
Signed-off-by: Juan Quintela <quintela@redhat.com> --- migration-exec.c | 10 +++++----- migration-fd.c | 10 +++++----- migration-tcp.c | 12 ++++++------ migration-unix.c | 12 ++++++------ migration.c | 34 +++++++++++++++++----------------- migration.h | 38 +++++++++++++++++++------------------- 6 files changed, 58 insertions(+), 58 deletions(-)