Patchwork [v3,28/35] arch_init: factor out setting last_block, last_offset

login
register
mail settings
Submitter Isaku Yamahata
Date Oct. 30, 2012, 8:33 a.m.
Message ID <3204d6ba83d6f5697b1c547bcf7fe333eab7b609.1351582535.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/195432/
State New
Headers show

Comments

Isaku Yamahata - Oct. 30, 2012, 8:33 a.m.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 arch_init.c |   10 +++++++---
 arch_init.h |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/arch_init.c b/arch_init.c
index d95ce7b..9137013 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -416,6 +416,12 @@  static void migration_bitmap_sync(void)
 
 static uint64_t bytes_transferred;
 
+void ram_save_set_last_block(RAMBlock *block, ram_addr_t offset)
+{
+    last_block = block;
+    last_offset = offset;
+}
+
 /*
  * ram_save_page: Writes a page of memory to the stream f
  *
@@ -496,9 +502,7 @@  bool ram_save_block(QEMUFile *f, bool last_stage)
         }
     } while (block != last_block || offset != last_offset);
 
-    last_block = block;
-    last_offset = offset;
-
+    ram_save_set_last_block(block, offset);
     return wrote;
 }
 
diff --git a/arch_init.h b/arch_init.h
index 499d0f1..9165456 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -49,6 +49,7 @@  CpuDefinitionInfoList GCC_WEAK_DECL *arch_query_cpu_definitions(Error **errp);
 int ram_load_page(QEMUFile *f, void *host, int flags);
 
 #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
+void ram_save_set_last_block(RAMBlock *block, ram_addr_t offset);
 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);