diff mbox

[12/36] migration: rename qemu_file_has_error to qemu_file_get_error

Message ID b5ce7a27d5dcf6390f6b151367c1b1bad68a5b28.1318326683.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Oct. 11, 2011, 10 a.m. UTC
Now the function returned errno, so it is better the new name.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 arch_init.c       |    2 +-
 block-migration.c |    8 ++++----
 buffered_file.c   |   14 +++++++-------
 hw/hw.h           |    2 +-
 migration.c       |    2 +-
 savevm.c          |   13 +++++++------
 6 files changed, 21 insertions(+), 20 deletions(-)

Comments

Anthony Liguori Oct. 17, 2011, 2 p.m. UTC | #1
On 10/11/2011 05:00 AM, Juan Quintela wrote:
> Now the function returned errno, so it is better the new name.
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   arch_init.c       |    2 +-
>   block-migration.c |    8 ++++----
>   buffered_file.c   |   14 +++++++-------
>   hw/hw.h           |    2 +-
>   migration.c       |    2 +-
>   savevm.c          |   13 +++++++------
>   6 files changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 941d585..9128be0 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -451,7 +451,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
>
>               qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
>           }
> -        if (qemu_file_has_error(f)) {
> +        if (qemu_file_get_error(f)) {
>               return -EIO;
>           }
>       } while (!(flags&  RAM_SAVE_FLAG_EOS));
> diff --git a/block-migration.c b/block-migration.c
> index 2638f51..8308753 100644
> --- a/block-migration.c
> +++ b/block-migration.c
> @@ -579,7 +579,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>
>       flush_blks(f);
>
> -    if (qemu_file_has_error(f)) {
> +    if (qemu_file_get_error(f)) {
>           blk_mig_cleanup(mon);
>           return 0;
>       }
> @@ -607,7 +607,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>
>           flush_blks(f);
>
> -        if (qemu_file_has_error(f)) {
> +        if (qemu_file_get_error(f)) {
>               blk_mig_cleanup(mon);
>               return 0;
>           }
> @@ -624,7 +624,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>           /* report completion */
>           qemu_put_be64(f, (100<<  BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
>
> -        if (qemu_file_has_error(f)) {
> +        if (qemu_file_get_error(f)) {
>               return 0;
>           }
>
> @@ -704,7 +704,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
>               fprintf(stderr, "Unknown flags\n");
>               return -EINVAL;
>           }
> -        if (qemu_file_has_error(f)) {
> +        if (qemu_file_get_error(f)) {
>               return -EIO;
>           }
>       } while (!(flags&  BLK_MIG_FLAG_EOS));
> diff --git a/buffered_file.c b/buffered_file.c
> index 3e5333c..82f4001 100644
> --- a/buffered_file.c
> +++ b/buffered_file.c
> @@ -72,7 +72,7 @@ static void buffered_flush(QEMUFileBuffered *s)
>   {
>       size_t offset = 0;
>
> -    if (qemu_file_has_error(s->file)) {
> +    if (qemu_file_get_error(s->file)) {
>           DPRINTF("flush when error, bailing\n");
>           return;
>       }
> @@ -113,7 +113,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
>
>       DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos);
>
> -    if (qemu_file_has_error(s->file)) {
> +    if (qemu_file_get_error(s->file)) {
>           DPRINTF("flush when error, bailing\n");
>           return -EINVAL;
>       }
> @@ -172,7 +172,7 @@ static int buffered_close(void *opaque)
>
>       DPRINTF("closing\n");
>
> -    while (!qemu_file_has_error(s->file)&&  s->buffer_size) {
> +    while (!qemu_file_get_error(s->file)&&  s->buffer_size) {
>           buffered_flush(s);
>           if (s->freeze_output)
>               s->wait_for_unfreeze(s->opaque);
> @@ -192,7 +192,7 @@ static int buffered_rate_limit(void *opaque)
>   {
>       QEMUFileBuffered *s = opaque;
>
> -    if (qemu_file_has_error(s->file)) {
> +    if (qemu_file_get_error(s->file)) {
>           return 1;
>       }
>       if (s->freeze_output)
> @@ -207,9 +207,9 @@ static int buffered_rate_limit(void *opaque)
>   static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
>   {
>       QEMUFileBuffered *s = opaque;
> -    if (qemu_file_has_error(s->file))
> +    if (qemu_file_get_error(s->file)) {
>           goto out;
> -
> +    }
>       if (new_rate>  SIZE_MAX) {
>           new_rate = SIZE_MAX;
>       }
> @@ -231,7 +231,7 @@ static void buffered_rate_tick(void *opaque)
>   {
>       QEMUFileBuffered *s = opaque;
>
> -    if (qemu_file_has_error(s->file)) {
> +    if (qemu_file_get_error(s->file)) {
>           buffered_close(s);
>           return;
>       }
> diff --git a/hw/hw.h b/hw/hw.h
> index 6cf8cd2..ed20f5a 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -85,7 +85,7 @@ uint64_t qemu_get_be64(QEMUFile *f);
>   int qemu_file_rate_limit(QEMUFile *f);
>   int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
>   int64_t qemu_file_get_rate_limit(QEMUFile *f);
> -int qemu_file_has_error(QEMUFile *f);
> +int qemu_file_get_error(QEMUFile *f);
>   void qemu_file_set_error(QEMUFile *f, int error);
>
>   /* Try to send any outstanding data.  This function is useful when output is
> diff --git a/migration.c b/migration.c
> index 541da98..6bac734 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -313,7 +313,7 @@ void migrate_fd_put_notify(void *opaque)
>
>       qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
>       qemu_file_put_notify(s->file);
> -    if (qemu_file_has_error(s->file)) {
> +    if (qemu_file_get_error(s->file)) {
>           migrate_fd_error(s);
>       }
>   }
> diff --git a/savevm.c b/savevm.c
> index 8bc7272..c037eb3 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -425,7 +425,7 @@ QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer,
>       return f;
>   }
>
> -int qemu_file_has_error(QEMUFile *f)
> +int qemu_file_get_error(QEMUFile *f)
>   {
>       return f->has_error;
>   }
> @@ -1498,7 +1498,7 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
>
>           se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque);
>       }
> -    ret = qemu_file_has_error(f);
> +    ret = qemu_file_get_error(f);
>       if (ret != 0) {
>           qemu_savevm_state_cancel(mon, f);
>       }
> @@ -1532,7 +1532,7 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
>       if (ret != 0) {
>           return ret;
>       }
> -    ret = qemu_file_has_error(f);
> +    ret = qemu_file_get_error(f);
>       if (ret != 0) {
>           qemu_savevm_state_cancel(mon, f);
>       }
> @@ -1579,7 +1579,7 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
>
>       qemu_put_byte(f, QEMU_VM_EOF);
>
> -    return qemu_file_has_error(f);
> +    return qemu_file_get_error(f);
>   }
>
>   void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
> @@ -1620,7 +1620,7 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
>
>   out:
>       if (ret == 0) {
> -        ret = qemu_file_has_error(f);
> +        ret = qemu_file_get_error(f);
>       }
>
>       if (!ret&&  saved_vm_running)
> @@ -1835,8 +1835,9 @@ out:
>           g_free(le);
>       }
>
> -    if (qemu_file_has_error(f))
> +    if (qemu_file_get_error(f)) {
>           ret = -EIO;
> +    }
>
>       return ret;
>   }
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 941d585..9128be0 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -451,7 +451,7 @@  int ram_load(QEMUFile *f, void *opaque, int version_id)

             qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
         }
-        if (qemu_file_has_error(f)) {
+        if (qemu_file_get_error(f)) {
             return -EIO;
         }
     } while (!(flags & RAM_SAVE_FLAG_EOS));
diff --git a/block-migration.c b/block-migration.c
index 2638f51..8308753 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -579,7 +579,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)

     flush_blks(f);

-    if (qemu_file_has_error(f)) {
+    if (qemu_file_get_error(f)) {
         blk_mig_cleanup(mon);
         return 0;
     }
@@ -607,7 +607,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)

         flush_blks(f);

-        if (qemu_file_has_error(f)) {
+        if (qemu_file_get_error(f)) {
             blk_mig_cleanup(mon);
             return 0;
         }
@@ -624,7 +624,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
         /* report completion */
         qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);

-        if (qemu_file_has_error(f)) {
+        if (qemu_file_get_error(f)) {
             return 0;
         }

@@ -704,7 +704,7 @@  static int block_load(QEMUFile *f, void *opaque, int version_id)
             fprintf(stderr, "Unknown flags\n");
             return -EINVAL;
         }
-        if (qemu_file_has_error(f)) {
+        if (qemu_file_get_error(f)) {
             return -EIO;
         }
     } while (!(flags & BLK_MIG_FLAG_EOS));
diff --git a/buffered_file.c b/buffered_file.c
index 3e5333c..82f4001 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -72,7 +72,7 @@  static void buffered_flush(QEMUFileBuffered *s)
 {
     size_t offset = 0;

-    if (qemu_file_has_error(s->file)) {
+    if (qemu_file_get_error(s->file)) {
         DPRINTF("flush when error, bailing\n");
         return;
     }
@@ -113,7 +113,7 @@  static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in

     DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos);

-    if (qemu_file_has_error(s->file)) {
+    if (qemu_file_get_error(s->file)) {
         DPRINTF("flush when error, bailing\n");
         return -EINVAL;
     }
@@ -172,7 +172,7 @@  static int buffered_close(void *opaque)

     DPRINTF("closing\n");

-    while (!qemu_file_has_error(s->file) && s->buffer_size) {
+    while (!qemu_file_get_error(s->file) && s->buffer_size) {
         buffered_flush(s);
         if (s->freeze_output)
             s->wait_for_unfreeze(s->opaque);
@@ -192,7 +192,7 @@  static int buffered_rate_limit(void *opaque)
 {
     QEMUFileBuffered *s = opaque;

-    if (qemu_file_has_error(s->file)) {
+    if (qemu_file_get_error(s->file)) {
         return 1;
     }
     if (s->freeze_output)
@@ -207,9 +207,9 @@  static int buffered_rate_limit(void *opaque)
 static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
 {
     QEMUFileBuffered *s = opaque;
-    if (qemu_file_has_error(s->file))
+    if (qemu_file_get_error(s->file)) {
         goto out;
-
+    }
     if (new_rate > SIZE_MAX) {
         new_rate = SIZE_MAX;
     }
@@ -231,7 +231,7 @@  static void buffered_rate_tick(void *opaque)
 {
     QEMUFileBuffered *s = opaque;

-    if (qemu_file_has_error(s->file)) {
+    if (qemu_file_get_error(s->file)) {
         buffered_close(s);
         return;
     }
diff --git a/hw/hw.h b/hw/hw.h
index 6cf8cd2..ed20f5a 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -85,7 +85,7 @@  uint64_t qemu_get_be64(QEMUFile *f);
 int qemu_file_rate_limit(QEMUFile *f);
 int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
 int64_t qemu_file_get_rate_limit(QEMUFile *f);
-int qemu_file_has_error(QEMUFile *f);
+int qemu_file_get_error(QEMUFile *f);
 void qemu_file_set_error(QEMUFile *f, int error);

 /* Try to send any outstanding data.  This function is useful when output is
diff --git a/migration.c b/migration.c
index 541da98..6bac734 100644
--- a/migration.c
+++ b/migration.c
@@ -313,7 +313,7 @@  void migrate_fd_put_notify(void *opaque)

     qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     qemu_file_put_notify(s->file);
-    if (qemu_file_has_error(s->file)) {
+    if (qemu_file_get_error(s->file)) {
         migrate_fd_error(s);
     }
 }
diff --git a/savevm.c b/savevm.c
index 8bc7272..c037eb3 100644
--- a/savevm.c
+++ b/savevm.c
@@ -425,7 +425,7 @@  QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer,
     return f;
 }

-int qemu_file_has_error(QEMUFile *f)
+int qemu_file_get_error(QEMUFile *f)
 {
     return f->has_error;
 }
@@ -1498,7 +1498,7 @@  int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,

         se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque);
     }
-    ret = qemu_file_has_error(f);
+    ret = qemu_file_get_error(f);
     if (ret != 0) {
         qemu_savevm_state_cancel(mon, f);
     }
@@ -1532,7 +1532,7 @@  int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
     if (ret != 0) {
         return ret;
     }
-    ret = qemu_file_has_error(f);
+    ret = qemu_file_get_error(f);
     if (ret != 0) {
         qemu_savevm_state_cancel(mon, f);
     }
@@ -1579,7 +1579,7 @@  int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)

     qemu_put_byte(f, QEMU_VM_EOF);

-    return qemu_file_has_error(f);
+    return qemu_file_get_error(f);
 }

 void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
@@ -1620,7 +1620,7 @@  static int qemu_savevm_state(Monitor *mon, QEMUFile *f)

 out:
     if (ret == 0) {
-        ret = qemu_file_has_error(f);
+        ret = qemu_file_get_error(f);
     }

     if (!ret && saved_vm_running)
@@ -1835,8 +1835,9 @@  out:
         g_free(le);
     }

-    if (qemu_file_has_error(f))
+    if (qemu_file_get_error(f)) {
         ret = -EIO;
+    }

     return ret;
 }