qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] savevm: Use QEMU_VM_SECTION_* macros in ram_save_li


From: Fernando Luis Vázquez Cao
Subject: [Qemu-devel] [PATCH] savevm: Use QEMU_VM_SECTION_* macros in ram_save_live()
Date: Thu, 04 Jun 2009 11:49:49 +0900
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

In ram_save_live() the stage is determined directly from its
numerical value instead of using the corresponding macro
associated with each stage. Move the QEMU_VM_SECTION_* macros to
a header file so that they are available to ram_save_live() and
potential future users.

Signed-off-by: Fernando Luis Vazquez Cao <address@hidden>
---

diff -urNp qemu-0.10.5-orig/savevm.c qemu-0.10.5/savevm.c
--- qemu-0.10.5-orig/savevm.c   2009-05-21 05:47:00.000000000 +0900
+++ qemu-0.10.5/savevm.c        2009-06-04 10:49:35.000000000 +0900
@@ -663,12 +663,6 @@ void unregister_savevm(const char *idstr
 #define QEMU_VM_FILE_VERSION_COMPAT  0x00000002
 #define QEMU_VM_FILE_VERSION         0x00000003

-#define QEMU_VM_EOF                  0x00
-#define QEMU_VM_SECTION_START        0x01
-#define QEMU_VM_SECTION_PART         0x02
-#define QEMU_VM_SECTION_END          0x03
-#define QEMU_VM_SECTION_FULL         0x04
-
 int qemu_savevm_state_begin(QEMUFile *f)
 {
     SaveStateEntry *se;
diff -urNp qemu-0.10.5-orig/sysemu.h qemu-0.10.5/sysemu.h
--- qemu-0.10.5-orig/sysemu.h   2009-05-21 05:47:00.000000000 +0900
+++ qemu-0.10.5/sysemu.h        2009-06-04 10:49:22.000000000 +0900
@@ -39,6 +39,12 @@ void qemu_system_powerdown(void);
 #endif
 void qemu_system_reset(void);

+#define QEMU_VM_EOF                  0x00
+#define QEMU_VM_SECTION_START        0x01
+#define QEMU_VM_SECTION_PART         0x02
+#define QEMU_VM_SECTION_END          0x03
+#define QEMU_VM_SECTION_FULL         0x04
+
 void do_savevm(const char *name);
 void do_loadvm(const char *name);
 void do_delvm(const char *name);
diff -urNp qemu-0.10.5-orig/vl.c qemu-0.10.5/vl.c
--- qemu-0.10.5-orig/vl.c       2009-05-21 05:47:01.000000000 +0900
+++ qemu-0.10.5/vl.c    2009-06-04 10:54:29.000000000 +0900
@@ -3201,7 +3201,7 @@ static int ram_save_live(QEMUFile *f, in
 {
     ram_addr_t addr;

-    if (stage == 1) {
+    if (stage == QEMU_VM_SECTION_START) {
         /* Make sure all dirty bits are set */
         for (addr = 0; addr < phys_ram_size; addr += TARGET_PAGE_SIZE) {
             if (!cpu_physical_memory_get_dirty(addr, MIGRATION_DIRTY_FLAG))
@@ -3224,7 +3224,7 @@ static int ram_save_live(QEMUFile *f, in

     /* try transferring iterative blocks of memory */

-    if (stage == 3) {
+    if (stage == QEMU_VM_SECTION_END) {

         /* flush all remaining blocks regardless of rate limiting */
         while (ram_save_block(f) != 0);
@@ -3233,7 +3233,8 @@ static int ram_save_live(QEMUFile *f, in

     qemu_put_be64(f, RAM_SAVE_FLAG_EOS);

-    return (stage == 2) && (ram_save_remaining() < ram_save_threshold);
+    return (stage == QEMU_VM_SECTION_PART) &&
+            (ram_save_remaining() < ram_save_threshold);
 }

 static int ram_load_dead(QEMUFile *f, void *opaque)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]