Introduce RAM_SAVE_VERSION_ID to represent version_id for ram save format.

Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>
---
 arch_init.c |    2 +-
 arch_init.h |    2 ++
 vl.c        |    3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 4b65221..23717d3 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -784,7 +784,7 @@ static int ram_load(QEMUFile *f, void *opaque, int 
version_id)
 
     seq_iter++;
 
-    if (version_id < 4 || version_id > 4) {
+    if (version_id < 4 || version_id > RAM_SAVE_VERSION_ID) {
         return -EINVAL;
     }
 
diff --git a/arch_init.h b/arch_init.h
index e4c131e..780eedf 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -44,4 +44,6 @@ CpuDefinitionInfoList GCC_WEAK_DECL 
*arch_query_cpu_definitions(Error **errp);
 #define RAM_SAVE_FLAG_CONTINUE 0x20
 #define RAM_SAVE_FLAG_XBZRLE   0x40
 
+#define RAM_SAVE_VERSION_ID     4 /* currently version 4 */
+
 #endif
diff --git a/vl.c b/vl.c
index ee3c43a..723fc59 100644
--- a/vl.c
+++ b/vl.c
@@ -3557,7 +3557,8 @@ int main(int argc, char **argv, char **envp)
     default_drive(default_sdcard, snapshot, machine->use_scsi,
                   IF_SD, 0, SD_OPTS);
 
-    register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
+    register_savevm_live(NULL, "ram", 0, RAM_SAVE_VERSION_ID,
+                         &savevm_ram_handlers, NULL);
 
     if (nb_numa_nodes > 0) {
         int i;
-- 
1.7.10.4


Reply via email to