[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 30/35] arch_init: factor out ram_load
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v3 30/35] arch_init: factor out ram_load |
Date: |
Tue, 30 Oct 2012 17:33:06 +0900 |
Signed-off-by: Isaku Yamahata <address@hidden>
---
arch_init.c | 13 ++++++++++---
arch_init.h | 3 +++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 9137013..f86a0b4 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -867,7 +867,9 @@ int ram_load_page(QEMUFile *f, void *host, int flags)
return 0;
}
-static int ram_load(QEMUFile *f, void *opaque, int version_id)
+int ram_load(QEMUFile *f, void *opaque, int version_id,
+ void *(host_from_stream_offset_p)(QEMUFile *f,
+ ram_addr_t offsset, int flags))
{
ram_addr_t addr;
int flags, ret = 0;
@@ -899,7 +901,7 @@ static int ram_load(QEMUFile *f, void *opaque, int
version_id)
if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE |
RAM_SAVE_FLAG_XBZRLE)) {
- host = host_from_stream_offset(f, addr, flags);
+ host = host_from_stream_offset_p(f, addr, flags);
if (!host) {
return -EINVAL;
}
@@ -922,6 +924,11 @@ done:
return ret;
}
+static int ram_load_precopy(QEMUFile *f, void *opaque, int version_id)
+{
+ return ram_load(f, opaque, version_id, &host_from_stream_offset);
+}
+
static void ram_save_set_params(const MigrationParams *params, void *opaque)
{
if (params->postcopy) {
@@ -940,7 +947,7 @@ SaveVMHandlers savevm_ram_handlers = {
.save_live_setup = ram_save_setup,
.save_live_iterate = ram_save_iterate,
.save_live_complete = ram_save_complete,
- .load_state = ram_load,
+ .load_state = ram_load_precopy,
.cancel = ram_migration_cancel,
};
diff --git a/arch_init.h b/arch_init.h
index 9165456..3977ca7 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -54,6 +54,9 @@ bool ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t
offset,
bool last_stage);
RAMBlock *ram_find_block(const char *id, uint8_t len);
int ram_load_mem_size(QEMUFile *f, ram_addr_t total_ram_bytes);
+int ram_load(QEMUFile *f, void *opaque, int version_id,
+ void *(host_from_stream_offset_p)(QEMUFile *f,
+ ram_addr_t offsset, int flags));
#endif
#endif
--
1.7.10.4
- [Qemu-devel] [PATCH v3 07/35] savevm: export qemu_peek_buffer, qemu_peek_byte, qemu_file_skip, qemu_fflush, (continued)
- [Qemu-devel] [PATCH v3 07/35] savevm: export qemu_peek_buffer, qemu_peek_byte, qemu_file_skip, qemu_fflush, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 15/35] arch_init/ram_save_setup: factor out bitmap alloc/free, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 19/35] uvmem.h: import Linux uvmem.h and teach update-linux-headers.sh, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 31/35] arch_init: export ram_save_iterate(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 28/35] arch_init: factor out setting last_block, last_offset, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 17/35] arch_init: factor out logic to find ram block with id string, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 18/35] migration: export migrate_fd_completed() and migrate_fd_cleanup(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 34/35] postcopy/outgoing: introduce precopy_count parameter, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 16/35] arch_init/ram_load: refactor ram_load, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 13/35] arch_init/ram_save: introduce constant for ram save version = 4, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 30/35] arch_init: factor out ram_load,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v3 22/35] savevm: add new section that is used by postcopy, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 32/35] postcopy: pre+post optimization incoming side, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 21/35] postcopy: introduce helper functions for postcopy, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 35/35] postcopy: pre+post optimization outgoing side, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 27/35] postcopy/outgoing: implement forward/backword prefault, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 23/35] postcopy: implement incoming part of postcopy live migration, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 25/35] postcopy: implement outgoing part of postcopy live migration, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 26/35] postcopy/outgoing: add -n options to disable background transfer, Isaku Yamahata, 2012/10/30
- Re: [Qemu-devel] [PATCH v3 00/35] postcopy live migration, Benoit Hudzia, 2012/10/30