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)
+static int exec_close(MigrationState *s)
{
int ret = 0;
DPRINTF("exec_close\n");
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));
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)
+static int fd_close(MigrationState *s)
{
DPRINTF("fd_close\n");
if (s->fd != -1) {
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));
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)
+static int tcp_close(MigrationState *s)
{
DPRINTF("tcp_close\n");
if (s->fd != -1) {
static void tcp_wait_for_connect(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int val, ret;
socklen_t valsize = sizeof(val);
}
}
-FdMigrationState *tcp_start_outgoing_migration(Monitor *mon,
+MigrationState *tcp_start_outgoing_migration(Monitor *mon,
const char *host_port,
int64_t bandwidth_limit,
int detach,
int inc)
{
struct sockaddr_in addr;
- FdMigrationState *s;
+ MigrationState *s;
int ret;
if (parse_host_port(&addr, host_port) < 0)
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)
+static int unix_close(MigrationState *s)
{
DPRINTF("unix_close\n");
if (s->fd != -1) {
static void unix_wait_for_connect(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int val, ret;
socklen_t valsize = sizeof(val);
}
}
-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;
/* 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);
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);
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);
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) {
QDict *qdict;
if (current_migration) {
- FdMigrationState *s = current_migration;
+ MigrationState *s = current_migration;
switch (s->get_status(current_migration)) {
case MIG_STATE_ACTIVE:
/* 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) {
}
}
-void migrate_fd_error(FdMigrationState *s)
+void migrate_fd_error(MigrationState *s)
{
DPRINTF("setting error state\n");
s->state = MIG_STATE_ERROR;
migrate_fd_cleanup(s);
}
-int migrate_fd_cleanup(FdMigrationState *s)
+int migrate_fd_cleanup(MigrationState *s)
{
int ret = 0;
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);
ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
ssize_t ret;
if (s->state != MIG_STATE_ACTIVE) {
return ret;
}
-void migrate_fd_connect(FdMigrationState *s)
+void migrate_fd_connect(MigrationState *s)
{
int ret;
void migrate_fd_put_ready(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int ret;
if (s->state != MIG_STATE_ACTIVE) {
}
}
-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;
migrate_fd_cleanup(s);
}
-void migrate_fd_release(FdMigrationState *s)
+void migrate_fd_release(MigrationState *s)
{
DPRINTF("releasing state\n");
void migrate_fd_wait_for_unfreeze(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
int ret;
DPRINTF("wait for unfreeze\n");
int migrate_fd_close(void *opaque)
{
- FdMigrationState *s = opaque;
+ MigrationState *s = opaque;
if (s->mon) {
monitor_resume(s->mon);
#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*);
- 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);
+ 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;
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,
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,
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,
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);