target-i386: Use mulu2 and muls2
[qemu/pbrook.git] / include / migration / migration.h
blobd1214097fe4e7bf6400fd1f1532c6e604a5929ea
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 #include "qapi/qmp/qdict.h"
18 #include "qemu-common.h"
19 #include "qemu/thread.h"
20 #include "qemu/notify.h"
21 #include "qapi/error.h"
22 #include "migration/vmstate.h"
23 #include "qapi-types.h"
25 struct MigrationParams {
26 bool blk;
27 bool shared;
30 typedef struct MigrationState MigrationState;
32 struct MigrationState
34 int64_t bandwidth_limit;
35 size_t bytes_xfer;
36 size_t xfer_limit;
37 uint8_t *buffer;
38 size_t buffer_size;
39 size_t buffer_capacity;
40 QemuThread thread;
42 QEMUFile *file;
43 int fd;
44 int state;
45 int (*get_error)(MigrationState *s);
46 int (*close)(MigrationState *s);
47 int (*write)(MigrationState *s, const void *buff, size_t size);
48 void *opaque;
49 MigrationParams params;
50 int64_t total_time;
51 int64_t downtime;
52 int64_t expected_downtime;
53 int64_t dirty_pages_rate;
54 int64_t dirty_bytes_rate;
55 bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
56 int64_t xbzrle_cache_size;
57 bool complete;
60 void process_incoming_migration(QEMUFile *f);
62 void qemu_start_incoming_migration(const char *uri, Error **errp);
64 uint64_t migrate_max_downtime(void);
66 void do_info_migrate_print(Monitor *mon, const QObject *data);
68 void do_info_migrate(Monitor *mon, QObject **ret_data);
70 void exec_start_incoming_migration(const char *host_port, Error **errp);
72 void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
74 void tcp_start_incoming_migration(const char *host_port, Error **errp);
76 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
78 void unix_start_incoming_migration(const char *path, Error **errp);
80 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
82 void fd_start_incoming_migration(const char *path, Error **errp);
84 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
86 void migrate_fd_error(MigrationState *s);
88 void migrate_fd_connect(MigrationState *s);
90 int migrate_fd_close(MigrationState *s);
92 void add_migration_state_change_notifier(Notifier *notify);
93 void remove_migration_state_change_notifier(Notifier *notify);
94 bool migration_is_active(MigrationState *);
95 bool migration_has_finished(MigrationState *);
96 bool migration_has_failed(MigrationState *);
97 MigrationState *migrate_get_current(void);
99 uint64_t ram_bytes_remaining(void);
100 uint64_t ram_bytes_transferred(void);
101 uint64_t ram_bytes_total(void);
103 extern SaveVMHandlers savevm_ram_handlers;
105 uint64_t dup_mig_bytes_transferred(void);
106 uint64_t dup_mig_pages_transferred(void);
107 uint64_t norm_mig_bytes_transferred(void);
108 uint64_t norm_mig_pages_transferred(void);
109 uint64_t xbzrle_mig_bytes_transferred(void);
110 uint64_t xbzrle_mig_pages_transferred(void);
111 uint64_t xbzrle_mig_pages_overflow(void);
112 uint64_t xbzrle_mig_pages_cache_miss(void);
115 * @migrate_add_blocker - prevent migration from proceeding
117 * @reason - an error to be returned whenever migration is attempted
119 void migrate_add_blocker(Error *reason);
122 * @migrate_del_blocker - remove a blocking error from migration
124 * @reason - the error blocking migration
126 void migrate_del_blocker(Error *reason);
128 int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
129 uint8_t *dst, int dlen);
130 int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
132 int migrate_use_xbzrle(void);
133 int64_t migrate_xbzrle_cache_size(void);
135 int64_t xbzrle_cache_resize(int64_t new_size);
136 #endif