qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Fernando Luis Vázquez Cao" <fernando@oss.ntt.co.jp>
To: qemu-devel@nongnu.org, Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH] savevm: Use QEMU_VM_SECTION_* macros in ram_save_live()
Date: Thu, 04 Jun 2009 11:49:49 +0900	[thread overview]
Message-ID: <4A27364D.3090205@oss.ntt.co.jp> (raw)

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)

                 reply	other threads:[~2009-06-04  2:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A27364D.3090205@oss.ntt.co.jp \
    --to=fernando@oss.ntt.co.jp \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).