block-vpc: Write support (Kevin Wolf)
[qemu/mini2440/sniper_sniper_test.git] / migration.h
blobd9771adb8dd48d3d271266189422c2f17a32a206
1 /*
2 * QEMU live migration
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef QEMU_MIGRATION_H
15 #define QEMU_MIGRATION_H
17 #define MIG_STATE_ERROR -1
18 #define MIG_STATE_COMPLETED 0
19 #define MIG_STATE_CANCELLED 1
20 #define MIG_STATE_ACTIVE 2
22 typedef struct MigrationState MigrationState;
24 struct MigrationState
26 /* FIXME: add more accessors to print migration info */
27 void (*cancel)(MigrationState *s);
28 int (*get_status)(MigrationState *s);
29 void (*release)(MigrationState *s);
32 typedef struct FdMigrationState FdMigrationState;
34 struct FdMigrationState
36 MigrationState mig_state;
37 int64_t bandwidth_limit;
38 QEMUFile *file;
39 int fd;
40 int detach;
41 int state;
42 int (*get_error)(struct FdMigrationState*);
43 int (*close)(struct FdMigrationState*);
44 int (*write)(struct FdMigrationState*, const void *, size_t);
45 void *opaque;
48 void qemu_start_incoming_migration(const char *uri);
50 void do_migrate(int detach, const char *uri);
52 void do_migrate_cancel(void);
54 void do_migrate_set_speed(const char *value);
56 void do_info_migrate(void);
58 int exec_start_incoming_migration(const char *host_port);
60 MigrationState *exec_start_outgoing_migration(const char *host_port,
61 int64_t bandwidth_limit,
62 int detach);
64 int tcp_start_incoming_migration(const char *host_port);
66 MigrationState *tcp_start_outgoing_migration(const char *host_port,
67 int64_t bandwidth_limit,
68 int detach);
70 void migrate_fd_error(FdMigrationState *s);
72 void migrate_fd_cleanup(FdMigrationState *s);
74 void migrate_fd_put_notify(void *opaque);
76 ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size);
78 void migrate_fd_connect(FdMigrationState *s);
80 void migrate_fd_put_ready(void *opaque);
82 int migrate_fd_get_status(MigrationState *mig_state);
84 void migrate_fd_cancel(MigrationState *mig_state);
86 void migrate_fd_release(MigrationState *mig_state);
88 void migrate_fd_wait_for_unfreeze(void *opaque);
90 int migrate_fd_close(void *opaque);
92 static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state)
94 return container_of(mig_state, FdMigrationState, mig_state);
97 #endif