From e7aa99991f990b494fa8830ccbab5e9ff7a05477 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Wed, 19 Oct 2011 23:47:48 +0200 Subject: [PATCH 13/19] migration: rename qemu_file_has_error to qemu_file_get_error RH-Author: Juan Quintela Message-id: <17c7e3041f54e8e19c6769ce0897d721be0752e2.1319066771.git.quintela@redhat.com> Patchwork-id: 34439 O-Subject: [PATCH qemu-kvm RHEL-6.2 13/16] migration: rename qemu_file_has_error to qemu_file_get_error Bugzilla: 669581 RH-Acked-by: Amit Shah RH-Acked-by: Orit Wasserman RH-Acked-by: Markus Armbruster Now the function returned errno, so it is better the new name. Signed-off-by: Juan Quintela Reviewed-by: Anthony Liguori Conflicts: arch_init.c it is on vl.c on RHEL6 block-migration.c code changed a lot buffered_file.c parameter changed from int64_t to size_t hw/hw.h same than previous --- block-migration.c | 8 ++++---- buffered_file.c | 13 +++++++------ hw/hw.h | 2 +- migration.c | 2 +- savevm.c | 13 +++++++------ vl.c | 2 +- 6 files changed, 21 insertions(+), 19 deletions(-) Signed-off-by: Michal Novotny --- block-migration.c | 8 ++++---- buffered_file.c | 13 +++++++------ hw/hw.h | 2 +- migration.c | 2 +- savevm.c | 13 +++++++------ vl.c | 2 +- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/block-migration.c b/block-migration.c index 776df6d..122f561 100644 --- a/block-migration.c +++ b/block-migration.c @@ -429,7 +429,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; } @@ -446,7 +446,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; } @@ -462,7 +462,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; } @@ -520,7 +520,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 a855a88..14f7a24 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -73,7 +73,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; } @@ -114,7 +114,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; } @@ -173,7 +173,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); @@ -199,7 +199,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) @@ -215,8 +215,9 @@ static size_t buffered_set_rate_limit(void *opaque, size_t new_rate) { QEMUFileBuffered *s = opaque; - if (qemu_file_has_error(s->file)) + if (qemu_file_get_error(s->file)) { goto out; + } s->xfer_limit = new_rate / 10; @@ -235,7 +236,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 aae4bb6..479a9f2 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -87,7 +87,7 @@ uint64_t qemu_get_be64(QEMUFile *f); int qemu_file_rate_limit(QEMUFile *f); size_t qemu_file_set_rate_limit(QEMUFile *f, size_t new_rate); size_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 8710c38..d61188d 100644 --- a/migration.c +++ b/migration.c @@ -330,7 +330,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 fd67fbc..be16a17 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; } @@ -1521,7 +1521,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); } @@ -1568,7 +1568,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); } @@ -1613,7 +1613,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) @@ -1652,7 +1652,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); } return ret; @@ -1866,8 +1866,9 @@ out: qemu_free(le); } - if (qemu_file_has_error(f)) + if (qemu_file_get_error(f)) { ret = -EIO; + } return ret; } diff --git a/vl.c b/vl.c index fc0a57e..547be13 100644 --- a/vl.c +++ b/vl.c @@ -3131,7 +3131,7 @@ static 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)); -- 1.7.4.4