Patchwork [40/41] savevm: make qemu_file_put_notify() return errors

login
register
mail settings
Submitter Juan Quintela
Date Oct. 2, 2012, 11:33 a.m.
Message ID <1349177616-5341-41-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/188462/
State New
Headers show

Comments

Juan Quintela - Oct. 2, 2012, 11:33 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration.c | 5 +++--
 qemu-file.h | 2 +-
 savevm.c    | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index 2c93951..62e0304 100644
--- a/migration.c
+++ b/migration.c
@@ -287,10 +287,11 @@  static void migrate_fd_completed(MigrationState *s)
 static void migrate_fd_put_notify(void *opaque)
 {
     MigrationState *s = opaque;
+    int ret;

     qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
-    qemu_file_put_notify(s->file);
-    if (s->file && qemu_file_get_error(s->file)) {
+    ret = qemu_file_put_notify(s->file);
+    if (ret) {
         migrate_fd_error(s);
     }
 }
diff --git a/qemu-file.h b/qemu-file.h
index 8dd9207..9c8985b 100644
--- a/qemu-file.h
+++ b/qemu-file.h
@@ -107,7 +107,7 @@  int qemu_file_get_error(QEMUFile *f);
 /* Try to send any outstanding data.  This function is useful when output is
  * halted due to rate limiting or EAGAIN errors occur as it can be used to
  * resume output. */
-void qemu_file_put_notify(QEMUFile *f);
+int qemu_file_put_notify(QEMUFile *f);

 static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
 {
diff --git a/savevm.c b/savevm.c
index 68c0464..2ea1fa6 100644
--- a/savevm.c
+++ b/savevm.c
@@ -523,9 +523,9 @@  int qemu_fclose(QEMUFile *f)
     return ret;
 }

-void qemu_file_put_notify(QEMUFile *f)
+int qemu_file_put_notify(QEMUFile *f)
 {
-    f->put_buffer(f->opaque, NULL, 0, 0);
+    return f->put_buffer(f->opaque, NULL, 0, 0);
 }

 void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)