qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] savevm: Use QEMU_VM_SECTION_* macros in ram_save_live()
@ 2009-06-04  2:49 Fernando Luis Vázquez Cao
  0 siblings, 0 replies; only message in thread
From: Fernando Luis Vázquez Cao @ 2009-06-04  2:49 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori

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 <fernando@oss.ntt.co.jp>
---

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-04  2:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04  2:49 [Qemu-devel] [PATCH] savevm: Use QEMU_VM_SECTION_* macros in ram_save_live() Fernando Luis Vázquez Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).