diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-02 14:07:53 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-02 14:07:53 +0100 |
commit | d47a851caeda96d5979bf48d4bae6a87784ad91d (patch) | |
tree | 2eba63ddc02a260a3ae0216e416adebd0d1ffa46 /include | |
parent | 7693cd7cb6229ca034faa88497ddb3a5f27cfb41 (diff) | |
parent | 2c9e6fec89ff032a3f75a5a1caccc31901fb4056 (diff) |
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170601' into staging
migration/next for 20170601
# gpg: Signature made Thu 01 Jun 2017 17:51:04 BST
# gpg: using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg: aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723
* remotes/juanquintela/tags/migration/20170601:
migration: Move include/migration/block.h into migration/
migration: Export ram.c functions in its own file
migration: Create include for migration snapshots
migration: Export rdma.c functions in its own file
migration: Export tls.c functions in its own file
migration: Export socket.c functions in its own file
migration: Export fd.c functions in its own file
migration: Export exec.c functions in its own file
migration: Split qemu-file.h
migration: Remove unneeded includes of migration/vmstate.h
migration: shut src return path unconditionally
migration: fix leak of src file on dst
migration: Remove section_id parameter from vmstate_load
migration: loadvm handlers are not used
migration: Use savevm_handlers instead of loadvm copy
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/block_int.h | 4 | ||||
-rw-r--r-- | include/hw/acpi/memory_hotplug.h | 1 | ||||
-rw-r--r-- | include/hw/acpi/pcihp.h | 1 | ||||
-rw-r--r-- | include/hw/hw.h | 2 | ||||
-rw-r--r-- | include/hw/pci/shpc.h | 1 | ||||
-rw-r--r-- | include/migration/block.h | 47 | ||||
-rw-r--r-- | include/migration/migration.h | 73 | ||||
-rw-r--r-- | include/migration/misc.h | 29 | ||||
-rw-r--r-- | include/migration/qemu-file-types.h | 164 | ||||
-rw-r--r-- | include/migration/qemu-file.h | 309 | ||||
-rw-r--r-- | include/migration/snapshot.h | 21 | ||||
-rw-r--r-- | include/migration/vmstate.h | 2 | ||||
-rw-r--r-- | include/qemu/typedefs.h | 1 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 3 |
14 files changed, 217 insertions, 441 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h index e5eb473e53..cb78c4fa82 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -601,8 +601,8 @@ struct BlockDriverState { int copy_on_read; /* If we are reading a disk image, give its size in sectors. - * Generally read-only; it is written to by load_vmstate and save_vmstate, - * but the block layer is quiescent during those. + * Generally read-only; it is written to by load_snapshot and + * save_snaphost, but the block layer is quiescent during those. */ int64_t total_sectors; diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h index db8ebc9cea..77c65765d6 100644 --- a/include/hw/acpi/memory_hotplug.h +++ b/include/hw/acpi/memory_hotplug.h @@ -3,7 +3,6 @@ #include "hw/qdev-core.h" #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/acpi/aml-build.h" /** diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index 04528b78d9..8a65f99fc8 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -28,7 +28,6 @@ #define HW_ACPI_PCIHP_H #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base" diff --git a/include/hw/hw.h b/include/hw/hw.h index af9eae11c5..ab4950c312 100644 --- a/include/hw/hw.h +++ b/include/hw/hw.h @@ -11,7 +11,7 @@ #include "exec/memory.h" #include "hw/irq.h" #include "migration/vmstate.h" -#include "migration/qemu-file.h" +#include "migration/qemu-file-types.h" #include "qemu/module.h" #include "sysemu/reset.h" diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h index b2085543d7..71e836b1c0 100644 --- a/include/hw/pci/shpc.h +++ b/include/hw/pci/shpc.h @@ -3,7 +3,6 @@ #include "qemu-common.h" #include "exec/memory.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #include "hw/pci/pci.h" diff --git a/include/migration/block.h b/include/migration/block.h deleted file mode 100644 index 28cff53a23..0000000000 --- a/include/migration/block.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * QEMU live block migration - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Liran Schour <lirans@il.ibm.com> - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef MIGRATION_BLOCK_H -#define MIGRATION_BLOCK_H - -#ifdef CONFIG_LIVE_BLOCK_MIGRATION -void blk_mig_init(void); -int blk_mig_active(void); -uint64_t blk_mig_bytes_transferred(void); -uint64_t blk_mig_bytes_remaining(void); -uint64_t blk_mig_bytes_total(void); - -#else -static inline void blk_mig_init(void) { } -static inline int blk_mig_active(void) -{ - return false; -} -static inline uint64_t blk_mig_bytes_transferred(void) -{ - return 0; -} - -static inline uint64_t blk_mig_bytes_remaining(void) -{ - return 0; -} - -static inline uint64_t blk_mig_bytes_total(void) -{ - return 0; -} -#endif /* CONFIG_LIVE_BLOCK_MIGRATION */ - -void migrate_set_block_enabled(bool value, Error **errp); -#endif /* MIGRATION_BLOCK_H */ diff --git a/include/migration/migration.h b/include/migration/migration.h index 0e807b63b8..79b5484d65 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -18,7 +18,6 @@ #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" -#include "io/channel.h" #include "qapi-types.h" #include "exec/cpu-common.h" #include "qemu/coroutine_int.h" @@ -50,8 +49,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; -typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head; - /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -89,9 +86,6 @@ struct MigrationIncomingState { /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; - - /* See savevm.c */ - LoadStateEntry_Head loadvm_handlers; }; MigrationIncomingState *migration_incoming_get_current(void); @@ -157,37 +151,8 @@ void migration_fd_process_incoming(QEMUFile *f); void qemu_start_incoming_migration(const char *uri, Error **errp); -void migration_tls_channel_process_incoming(MigrationState *s, - QIOChannel *ioc, - Error **errp); - -void migration_tls_channel_connect(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); - -void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp); - -void tcp_start_incoming_migration(const char *host_port, Error **errp); - -void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp); - -void unix_start_incoming_migration(const char *path, Error **errp); - -void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp); - -void fd_start_incoming_migration(const char *path, Error **errp); - -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp); - -void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp); - -void rdma_start_incoming_migration(const char *host_port, Error **errp); - void migrate_fd_error(MigrationState *s, const Error *error); void migrate_fd_connect(MigrationState *s); @@ -206,38 +171,6 @@ bool migration_in_postcopy(void); bool migration_in_postcopy_after_devices(MigrationState *); MigrationState *migrate_get_current(void); -void migrate_compress_threads_create(void); -void migrate_compress_threads_join(void); -void migrate_decompress_threads_create(void); -void migrate_decompress_threads_join(void); -uint64_t ram_bytes_remaining(void); -uint64_t ram_bytes_transferred(void); -uint64_t ram_bytes_total(void); -uint64_t ram_dirty_sync_count(void); -uint64_t ram_dirty_pages_rate(void); -uint64_t ram_postcopy_requests(void); -void free_xbzrle_decoded_buf(void); - -void acct_update_position(QEMUFile *f, size_t size, bool zero); - -uint64_t dup_mig_pages_transferred(void); -uint64_t norm_mig_pages_transferred(void); -uint64_t xbzrle_mig_bytes_transferred(void); -uint64_t xbzrle_mig_pages_transferred(void); -uint64_t xbzrle_mig_pages_overflow(void); -uint64_t xbzrle_mig_pages_cache_miss(void); -double xbzrle_mig_cache_miss_rate(void); - -void ram_handle_compressed(void *host, uint8_t ch, uint64_t size); -void ram_debug_dump_bitmap(unsigned long *todump, bool expected, - unsigned long pages); -/* For outgoing discard bitmap */ -int ram_postcopy_send_discard_bitmap(MigrationState *ms); -/* For incoming postcopy discard */ -int ram_discard_range(const char *block_name, uint64_t start, size_t length); -int ram_postcopy_incoming_init(MigrationIncomingState *mis); -void ram_postcopy_migrated_memory_release(MigrationState *ms); - bool migrate_release_ram(void); bool migrate_postcopy_ram(void); bool migrate_zero_blocks(void); @@ -248,8 +181,6 @@ int migrate_use_xbzrle(void); int64_t migrate_xbzrle_cache_size(void); bool migrate_colo_enabled(void); -int64_t xbzrle_cache_resize(int64_t new_size); - bool migrate_use_block(void); bool migrate_use_block_incremental(void); @@ -288,7 +219,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent); -void ram_mig_init(void); void savevm_skip_section_footers(void); void register_global_state(void); void global_state_set_optional(void); @@ -296,7 +226,4 @@ void savevm_skip_configuration(void); int global_state_store(void); void global_state_store_running(void); -void migration_page_queue_free(void); -int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len); -uint64_t ram_pagesize_summary(void); #endif diff --git a/include/migration/misc.h b/include/migration/misc.h new file mode 100644 index 0000000000..d7892b7956 --- /dev/null +++ b/include/migration/misc.h @@ -0,0 +1,29 @@ +/* + * QEMU migration miscellaneus exported functions + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori <aliguori@us.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef MIGRATION_MISC_H +#define MIGRATION_MISC_H + +/* migration/ram.c */ + +void ram_mig_init(void); + +/* migration/block.c */ + +#ifdef CONFIG_LIVE_BLOCK_MIGRATION +void blk_mig_init(void); +#else +static inline void blk_mig_init(void) {} +#endif + +#endif diff --git a/include/migration/qemu-file-types.h b/include/migration/qemu-file-types.h new file mode 100644 index 0000000000..bd6d7dd7f9 --- /dev/null +++ b/include/migration/qemu-file-types.h @@ -0,0 +1,164 @@ +/* + * QEMU System Emulator + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef QEMU_FILE_H +#define QEMU_FILE_H + +void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size); +void qemu_put_byte(QEMUFile *f, int v); + +#define qemu_put_sbyte qemu_put_byte + +void qemu_put_be16(QEMUFile *f, unsigned int v); +void qemu_put_be32(QEMUFile *f, unsigned int v); +void qemu_put_be64(QEMUFile *f, uint64_t v); +size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size); + +int qemu_get_byte(QEMUFile *f); + +static inline unsigned int qemu_get_ubyte(QEMUFile *f) +{ + return (unsigned int)qemu_get_byte(f); +} + +#define qemu_get_sbyte qemu_get_byte + +unsigned int qemu_get_be16(QEMUFile *f); +unsigned int qemu_get_be32(QEMUFile *f); +uint64_t qemu_get_be64(QEMUFile *f); + +static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) +{ + qemu_put_be64(f, *pv); +} + +static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) +{ + qemu_put_be32(f, *pv); +} + +static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) +{ + qemu_put_be16(f, *pv); +} + +static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) +{ + qemu_put_byte(f, *pv); +} + +static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) +{ + *pv = qemu_get_be64(f); +} + +static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) +{ + *pv = qemu_get_be32(f); +} + +static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) +{ + *pv = qemu_get_be16(f); +} + +static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) +{ + *pv = qemu_get_byte(f); +} + +/* Signed versions for type safety */ +static inline void qemu_put_sbe16(QEMUFile *f, int v) +{ + qemu_put_be16(f, (unsigned int)v); +} + +static inline void qemu_put_sbe32(QEMUFile *f, int v) +{ + qemu_put_be32(f, (unsigned int)v); +} + +static inline void qemu_put_sbe64(QEMUFile *f, int64_t v) +{ + qemu_put_be64(f, (uint64_t)v); +} + +static inline int qemu_get_sbe16(QEMUFile *f) +{ + return (int)qemu_get_be16(f); +} + +static inline int qemu_get_sbe32(QEMUFile *f) +{ + return (int)qemu_get_be32(f); +} + +static inline int64_t qemu_get_sbe64(QEMUFile *f) +{ + return (int64_t)qemu_get_be64(f); +} + +static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv) +{ + qemu_put_8s(f, (const uint8_t *)pv); +} + +static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv) +{ + qemu_put_be16s(f, (const uint16_t *)pv); +} + +static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv) +{ + qemu_put_be32s(f, (const uint32_t *)pv); +} + +static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv) +{ + qemu_put_be64s(f, (const uint64_t *)pv); +} + +static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv) +{ + qemu_get_8s(f, (uint8_t *)pv); +} + +static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv) +{ + qemu_get_be16s(f, (uint16_t *)pv); +} + +static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv) +{ + qemu_get_be32s(f, (uint32_t *)pv); +} + +static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv) +{ + qemu_get_be64s(f, (uint64_t *)pv); +} + +int qemu_file_rate_limit(QEMUFile *f); + +#endif diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h deleted file mode 100644 index b5ac800258..0000000000 --- a/include/migration/qemu-file.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_FILE_H -#define QEMU_FILE_H - -#include "qemu-common.h" -#include "exec/cpu-common.h" - -/* 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. - */ -typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, - int64_t pos, size_t size); - -/* Close a file - * - * Return negative error number on error, 0 or positive value on success. - * - * The meaning of return value on success depends on the specific back-end being - * used. - */ -typedef int (QEMUFileCloseFunc)(void *opaque); - -/* Called to return the OS file descriptor associated to the QEMUFile. - */ -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. 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); - -/* - * This function provides hooks around different - * stages of RAM migration. - * 'opaque' is the backend specific data in QEMUFile - * 'data' is call specific data associated with the 'flags' value - */ -typedef int (QEMURamHookFunc)(QEMUFile *f, void *opaque, uint64_t flags, - void *data); - -/* - * Constants used by ram_control_* hooks - */ -#define RAM_CONTROL_SETUP 0 -#define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_HOOK 2 -#define RAM_CONTROL_FINISH 3 -#define RAM_CONTROL_BLOCK_REG 4 - -/* - * This function allows override of where the RAM page - * is saved (such as RDMA, for example.) - */ -typedef size_t (QEMURamSaveFunc)(QEMUFile *f, void *opaque, - ram_addr_t block_offset, - ram_addr_t offset, - size_t size, - uint64_t *bytes_sent); - -/* - * Return a QEMUFile for comms in the opposite direction - */ -typedef QEMUFile *(QEMURetPathFunc)(void *opaque); - -/* - * Stop any read or write (depending on flags) on the underlying - * transport on the QEMUFile. - * Existing blocking reads/writes must be woken - * Returns 0 on success, -err on error - */ -typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr); - -typedef struct QEMUFileOps { - QEMUFileGetBufferFunc *get_buffer; - QEMUFileCloseFunc *close; - QEMUFileSetBlocking *set_blocking; - QEMUFileWritevBufferFunc *writev_buffer; - QEMURetPathFunc *get_return_path; - QEMUFileShutdownFunc *shut_down; -} QEMUFileOps; - -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); -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); -int64_t qemu_ftell_fast(QEMUFile *f); -void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size); -void qemu_put_byte(QEMUFile *f, int v); -/* - * put_buffer without copying the buffer. - * The buffer should be available till it is sent asynchronously. - */ -void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, - bool may_free); -bool qemu_file_mode_is_not_valid(const char *mode); -bool qemu_file_is_writable(QEMUFile *f); - - -static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v) -{ - qemu_put_byte(f, (int)v); -} - -#define qemu_put_sbyte qemu_put_byte - -void qemu_put_be16(QEMUFile *f, unsigned int v); -void qemu_put_be32(QEMUFile *f, unsigned int v); -void qemu_put_be64(QEMUFile *f, uint64_t v); -size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset); -size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size); -size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size); -ssize_t qemu_put_compression_data(QEMUFile *f, const uint8_t *p, size_t size, - int level); -int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src); - -/* - * Note that you can only peek continuous bytes from where the current pointer - * is; you aren't guaranteed to be able to peak to +n bytes unless you've - * previously peeked +n-1. - */ -int qemu_peek_byte(QEMUFile *f, int offset); -int qemu_get_byte(QEMUFile *f); -void qemu_file_skip(QEMUFile *f, int size); -void qemu_update_position(QEMUFile *f, size_t size); - -static inline unsigned int qemu_get_ubyte(QEMUFile *f) -{ - return (unsigned int)qemu_get_byte(f); -} - -#define qemu_get_sbyte qemu_get_byte - -unsigned int qemu_get_be16(QEMUFile *f); -unsigned int qemu_get_be32(QEMUFile *f); -uint64_t qemu_get_be64(QEMUFile *f); - -int qemu_file_rate_limit(QEMUFile *f); -void qemu_file_reset_rate_limit(QEMUFile *f); -void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); -int64_t qemu_file_get_rate_limit(QEMUFile *f); -int qemu_file_get_error(QEMUFile *f); -void qemu_file_set_error(QEMUFile *f, int ret); -int qemu_file_shutdown(QEMUFile *f); -QEMUFile *qemu_file_get_return_path(QEMUFile *f); -void qemu_fflush(QEMUFile *f); -void qemu_file_set_blocking(QEMUFile *f, bool block); - -static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) -{ - qemu_put_be64(f, *pv); -} - -static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) -{ - qemu_put_be32(f, *pv); -} - -static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) -{ - qemu_put_be16(f, *pv); -} - -static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) -{ - qemu_put_byte(f, *pv); -} - -static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) -{ - *pv = qemu_get_be64(f); -} - -static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) -{ - *pv = qemu_get_be32(f); -} - -static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) -{ - *pv = qemu_get_be16(f); -} - -static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) -{ - *pv = qemu_get_byte(f); -} - -// Signed versions for type safety -static inline void qemu_put_sbuffer(QEMUFile *f, const int8_t *buf, size_t size) -{ - qemu_put_buffer(f, (const uint8_t *)buf, size); -} - -static inline void qemu_put_sbe16(QEMUFile *f, int v) -{ - qemu_put_be16(f, (unsigned int)v); -} - -static inline void qemu_put_sbe32(QEMUFile *f, int v) -{ - qemu_put_be32(f, (unsigned int)v); -} - -static inline void qemu_put_sbe64(QEMUFile *f, int64_t v) -{ - qemu_put_be64(f, (uint64_t)v); -} - -static inline size_t qemu_get_sbuffer(QEMUFile *f, int8_t *buf, int size) -{ - return qemu_get_buffer(f, (uint8_t *)buf, size); -} - -static inline int qemu_get_sbe16(QEMUFile *f) -{ - return (int)qemu_get_be16(f); -} - -static inline int qemu_get_sbe32(QEMUFile *f) -{ - return (int)qemu_get_be32(f); -} - -static inline int64_t qemu_get_sbe64(QEMUFile *f) -{ - return (int64_t)qemu_get_be64(f); -} - -static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv) -{ - qemu_put_8s(f, (const uint8_t *)pv); -} - -static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv) -{ - qemu_put_be16s(f, (const uint16_t *)pv); -} - -static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv) -{ - qemu_put_be32s(f, (const uint32_t *)pv); -} - -static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv) -{ - qemu_put_be64s(f, (const uint64_t *)pv); -} - -static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv) -{ - qemu_get_8s(f, (uint8_t *)pv); -} - -static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv) -{ - qemu_get_be16s(f, (uint16_t *)pv); -} - -static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv) -{ - qemu_get_be32s(f, (uint32_t *)pv); -} - -static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv) -{ - qemu_get_be64s(f, (uint64_t *)pv); -} - -size_t qemu_get_counted_string(QEMUFile *f, char buf[256]); - -#endif diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h new file mode 100644 index 0000000000..c85b6ec75b --- /dev/null +++ b/include/migration/snapshot.h @@ -0,0 +1,21 @@ +/* + * QEMU snapshots + * + * Copyright (c) 2004-2008 Fabrice Bellard + * Copyright (c) 2009-2015 Red Hat Inc + * + * Authors: + * Juan Quintela <quintela@redhat.com> + * + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_MIGRATION_SNAPSHOT_H +#define QEMU_MIGRATION_SNAPSHOT_H + +int save_snapshot(const char *name, Error **errp); +int load_snapshot(const char *name, Error **errp); + +#endif diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f97411d31f..66895623da 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1020,8 +1020,6 @@ extern const VMStateInfo vmstate_info_qtailq; #define SELF_ANNOUNCE_ROUNDS 5 -void loadvm_free_handlers(MigrationIncomingState *mis); - int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, int version_id); void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 33a6aa18e3..51958bf7d3 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -39,7 +39,6 @@ typedef struct I2SCodec I2SCodec; typedef struct ISABus ISABus; typedef struct ISADevice ISADevice; typedef struct IsaDma IsaDma; -typedef struct LoadStateEntry LoadStateEntry; typedef struct MACAddr MACAddr; typedef struct MachineClass MachineClass; typedef struct MachineState MachineState; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 723c8dcb1a..9841a527a1 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -92,9 +92,6 @@ void qemu_remove_exit_notifier(Notifier *notify); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); -int save_vmstate(const char *name, Error **errp); -int load_vmstate(const char *name, Error **errp); - void qemu_announce_self(void); extern int autostart; |