diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/migration/migration.h | 26 | ||||
-rw-r--r-- | include/migration/qemu-file.h | 57 | ||||
-rw-r--r-- | include/qapi/error.h | 2 | ||||
-rw-r--r-- | include/qemu/typedefs.h | 1 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 2 |
5 files changed, 44 insertions, 44 deletions
diff --git a/include/migration/migration.h b/include/migration/migration.h index 9e36a97fc5..13b12b7e87 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -135,9 +135,12 @@ struct MigrationState QemuThread thread; QEMUBH *cleanup_bh; QEMUFile *to_dst_file; - int parameters[MIGRATION_PARAMETER__MAX]; + + /* New style params from 'migrate-set-parameters' */ + MigrationParameters parameters; int state; + /* Old style params from 'migrate' command */ MigrationParams params; /* State related to return path */ @@ -171,6 +174,9 @@ struct MigrationState QSIMPLEQ_HEAD(src_page_requests, MigrationSrcPageRequest) src_page_requests; /* The RAMBlock used in the last src_page_request */ RAMBlock *last_req_rb; + + /* The last error that occurred */ + Error *error; }; void migrate_set_state(int *state, int old_state, int new_state); @@ -179,6 +185,22 @@ void process_incoming_migration(QEMUFile *f); void qemu_start_incoming_migration(const char *uri, Error **errp); +void migration_set_incoming_channel(MigrationState *s, + QIOChannel *ioc); + +void migration_tls_set_incoming_channel(MigrationState *s, + QIOChannel *ioc, + Error **errp); + +void migration_set_outgoing_channel(MigrationState *s, + QIOChannel *ioc, + const char *hostname); + +void migration_tls_set_outgoing_channel(MigrationState *s, + QIOChannel *ioc, + const char *hostname, + Error **errp); + uint64_t migrate_max_downtime(void); void exec_start_incoming_migration(const char *host_port, Error **errp); @@ -201,7 +223,7 @@ void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error ** void rdma_start_incoming_migration(const char *host_port, Error **errp); -void migrate_fd_error(MigrationState *s); +void migrate_fd_error(MigrationState *s, const Error *error); void migrate_fd_connect(MigrationState *s); diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index 3f6b4ed581..2409a98967 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -23,16 +23,11 @@ */ #ifndef QEMU_FILE_H #define QEMU_FILE_H 1 +#include "qemu-common.h" #include "exec/cpu-common.h" +#include "io/channel.h" -/* This function writes a chunk of data to a file at the given position. - * The pos argument can be ignored if the file is only being used for - * streaming. The handler should try to write all of the data it can. - */ -typedef ssize_t (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf, - int64_t pos, size_t size); - /* Read a chunk of data from a file at the given position. The pos argument * can be ignored if the file is only be used for streaming. The number of * bytes actually read should be returned. @@ -53,8 +48,13 @@ typedef int (QEMUFileCloseFunc)(void *opaque); */ typedef int (QEMUFileGetFD)(void *opaque); +/* Called to change the blocking mode of the file + */ +typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled); + /* - * This function writes an iovec to file. + * This function writes an iovec to file. The handler must write all + * of the data or return a negative errno value. */ typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov, int iovcnt, int64_t pos); @@ -101,32 +101,25 @@ typedef QEMUFile *(QEMURetPathFunc)(void *opaque); typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr); typedef struct QEMUFileOps { - QEMUFilePutBufferFunc *put_buffer; QEMUFileGetBufferFunc *get_buffer; QEMUFileCloseFunc *close; - QEMUFileGetFD *get_fd; + QEMUFileSetBlocking *set_blocking; QEMUFileWritevBufferFunc *writev_buffer; - QEMURamHookFunc *before_ram_iterate; - QEMURamHookFunc *after_ram_iterate; - QEMURamHookFunc *hook_ram_load; - QEMURamSaveFunc *save_page; QEMURetPathFunc *get_return_path; QEMUFileShutdownFunc *shut_down; } QEMUFileOps; -struct QEMUSizedBuffer { - struct iovec *iov; - size_t n_iov; - size_t size; /* total allocated size in all iov's */ - size_t used; /* number of used bytes */ -}; +typedef struct QEMUFileHooks { + QEMURamHookFunc *before_ram_iterate; + QEMURamHookFunc *after_ram_iterate; + QEMURamHookFunc *hook_ram_load; + QEMURamSaveFunc *save_page; +} QEMUFileHooks; QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops); -QEMUFile *qemu_fopen(const char *filename, const char *mode); -QEMUFile *qemu_fdopen(int fd, const char *mode); -QEMUFile *qemu_fopen_socket(int fd, const char *mode); -QEMUFile *qemu_popen_cmd(const char *command, const char *mode); -QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input); +QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc); +QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc); +void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks); int qemu_get_fd(QEMUFile *f); int qemu_fclose(QEMUFile *f); int64_t qemu_ftell(QEMUFile *f); @@ -141,20 +134,6 @@ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size); bool qemu_file_mode_is_not_valid(const char *mode); bool qemu_file_is_writable(QEMUFile *f); -QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len); -void qsb_free(QEMUSizedBuffer *); -size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t length); -size_t qsb_get_length(const QEMUSizedBuffer *qsb); -ssize_t qsb_get_buffer(const QEMUSizedBuffer *, off_t start, size_t count, - uint8_t *buf); -ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *buf, - off_t pos, size_t count); - - -/* - * For use on files opened with qemu_bufopen - */ -const QEMUSizedBuffer *qemu_buf_get(QEMUFile *f); static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v) { diff --git a/include/qapi/error.h b/include/qapi/error.h index 11be2327c0..0576659603 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -134,7 +134,7 @@ typedef enum ErrorClass { /* * Get @err's human-readable error message. */ -const char *error_get_pretty(Error *err); +const char *error_get_pretty(const Error *err); /* * Get @err's error class. diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 1dcf6f5d53..b113fcf156 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -82,7 +82,6 @@ typedef struct QemuOpt QemuOpt; typedef struct QemuOpts QemuOpts; typedef struct QemuOptsList QemuOptsList; typedef struct QEMUSGList QEMUSGList; -typedef struct QEMUSizedBuffer QEMUSizedBuffer; typedef struct QEMUTimer QEMUTimer; typedef struct QEMUTimerListGroup QEMUTimerListGroup; typedef struct QObject QObject; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 618169c4d5..94281413d0 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -119,7 +119,7 @@ void qemu_savevm_command_send(QEMUFile *f, enum qemu_vm_cmd command, uint16_t len, uint8_t *data); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); -int qemu_savevm_send_packaged(QEMUFile *f, const QEMUSizedBuffer *qsb); +int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len); void qemu_savevm_send_postcopy_advise(QEMUFile *f); void qemu_savevm_send_postcopy_listen(QEMUFile *f); void qemu_savevm_send_postcopy_run(QEMUFile *f); |