qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 04/10] Add host_from_stream_offset_versioned


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH v9 04/10] Add host_from_stream_offset_versioned function
Date: Wed, 18 Apr 2012 12:24:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 04/11/2012 01:49 PM, Orit Wasserman wrote:
Signed-off-by: Orit Wasserman<address@hidden>
Signed-off-by: Benoit Hudzia<address@hidden>
Signed-off-by: Petter Svard<address@hidden>
Signed-off-by: Aidan Shribman<address@hidden>

ENOEXPLANATION

The indentation is wrong in this patch and the commit message needs to explain what's going on here.

BTW, SoB is supposed to represent a handling chain. If you're the last person to touch this patch, your SoB should be the last one.

Regards,

Anthony Liguori

---
  arch_init.c |   26 +++++++++++++++++++++++---
  1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 47b9fef..f1690cf 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -599,6 +599,18 @@ static inline void *host_from_stream_offset(QEMUFile *f,
      return NULL;
  }

+static inline void *host_from_stream_offset_versioned(int version_id,
+        QEMUFile *f, ram_addr_t offset, int flags)
+{
+        void *host;
+        if (version_id == 3) {
+                host = qemu_get_ram_ptr(offset);
+        } else {
+                host = host_from_stream_offset(f, offset, flags);
+        }
+        return host;
+}
+
  int ram_load(QEMUFile *f, void *opaque, int version_id)
  {
      ram_addr_t addr;
@@ -654,8 +666,11 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
              void *host;
              uint8_t ch;

-            host = host_from_stream_offset(f, addr, flags);
+            host = host_from_stream_offset_versioned(version_id,
+                                                     f, addr, flags);
              if (!host) {
+                fprintf(stderr, "Failed to convert RAM address to host"
+                        " for offset " RAM_ADDR_FMT "\n", addr);
                  return -EINVAL;
              }

@@ -670,8 +685,13 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
          } else if (flags&  RAM_SAVE_FLAG_PAGE) {
              void *host;

-            host = host_from_stream_offset(f, addr, flags);
-
+            host = host_from_stream_offset_versioned(version_id,
+                                                     f, addr, flags);
+            if (!host) {
+                fprintf(stderr, "Failed to convert RAM address to host"
+                        " for offset " RAM_ADDR_FMT "\n", addr);
+                return -EINVAL;
+            }
              qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
          }
          error = qemu_file_get_error(f);




reply via email to

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