mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
migration: rename qemu_file_has_error to qemu_file_get_error
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>
This commit is contained in:
parent
3934638539
commit
624b9cc209
@ -451,7 +451,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|||||||
|
|
||||||
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
|
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
if (qemu_file_has_error(f)) {
|
if (qemu_file_get_error(f)) {
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
} while (!(flags & RAM_SAVE_FLAG_EOS));
|
} while (!(flags & RAM_SAVE_FLAG_EOS));
|
||||||
|
@ -580,7 +580,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
|
|||||||
|
|
||||||
flush_blks(f);
|
flush_blks(f);
|
||||||
|
|
||||||
if (qemu_file_has_error(f)) {
|
if (qemu_file_get_error(f)) {
|
||||||
blk_mig_cleanup(mon);
|
blk_mig_cleanup(mon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
|
|||||||
|
|
||||||
flush_blks(f);
|
flush_blks(f);
|
||||||
|
|
||||||
if (qemu_file_has_error(f)) {
|
if (qemu_file_get_error(f)) {
|
||||||
blk_mig_cleanup(mon);
|
blk_mig_cleanup(mon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
|
|||||||
/* report completion */
|
/* report completion */
|
||||||
qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
|
|||||||
fprintf(stderr, "Unknown flags\n");
|
fprintf(stderr, "Unknown flags\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (qemu_file_has_error(f)) {
|
if (qemu_file_get_error(f)) {
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
} while (!(flags & BLK_MIG_FLAG_EOS));
|
} while (!(flags & BLK_MIG_FLAG_EOS));
|
||||||
|
@ -72,7 +72,7 @@ static void buffered_flush(QEMUFileBuffered *s)
|
|||||||
{
|
{
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
if (qemu_file_has_error(s->file)) {
|
if (qemu_file_get_error(s->file)) {
|
||||||
DPRINTF("flush when error, bailing\n");
|
DPRINTF("flush when error, bailing\n");
|
||||||
return;
|
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);
|
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");
|
DPRINTF("flush when error, bailing\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ static int buffered_close(void *opaque)
|
|||||||
|
|
||||||
DPRINTF("closing\n");
|
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);
|
buffered_flush(s);
|
||||||
if (s->freeze_output)
|
if (s->freeze_output)
|
||||||
s->wait_for_unfreeze(s->opaque);
|
s->wait_for_unfreeze(s->opaque);
|
||||||
@ -198,7 +198,7 @@ static int buffered_rate_limit(void *opaque)
|
|||||||
{
|
{
|
||||||
QEMUFileBuffered *s = opaque;
|
QEMUFileBuffered *s = opaque;
|
||||||
|
|
||||||
if (qemu_file_has_error(s->file)) {
|
if (qemu_file_get_error(s->file)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (s->freeze_output)
|
if (s->freeze_output)
|
||||||
@ -213,9 +213,9 @@ static int buffered_rate_limit(void *opaque)
|
|||||||
static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
|
static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
|
||||||
{
|
{
|
||||||
QEMUFileBuffered *s = opaque;
|
QEMUFileBuffered *s = opaque;
|
||||||
if (qemu_file_has_error(s->file))
|
if (qemu_file_get_error(s->file)) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
if (new_rate > SIZE_MAX) {
|
if (new_rate > SIZE_MAX) {
|
||||||
new_rate = SIZE_MAX;
|
new_rate = SIZE_MAX;
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ static void buffered_rate_tick(void *opaque)
|
|||||||
{
|
{
|
||||||
QEMUFileBuffered *s = opaque;
|
QEMUFileBuffered *s = opaque;
|
||||||
|
|
||||||
if (qemu_file_has_error(s->file)) {
|
if (qemu_file_get_error(s->file)) {
|
||||||
buffered_close(s);
|
buffered_close(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
2
hw/hw.h
2
hw/hw.h
@ -85,7 +85,7 @@ uint64_t qemu_get_be64(QEMUFile *f);
|
|||||||
int qemu_file_rate_limit(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_set_rate_limit(QEMUFile *f, int64_t new_rate);
|
||||||
int64_t qemu_file_get_rate_limit(QEMUFile *f);
|
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);
|
void qemu_file_set_error(QEMUFile *f, int error);
|
||||||
|
|
||||||
/* Try to send any outstanding data. This function is useful when output is
|
/* Try to send any outstanding data. This function is useful when output is
|
||||||
|
@ -313,7 +313,7 @@ void migrate_fd_put_notify(void *opaque)
|
|||||||
|
|
||||||
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
|
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
|
||||||
qemu_file_put_notify(s->file);
|
qemu_file_put_notify(s->file);
|
||||||
if (qemu_file_has_error(s->file)) {
|
if (qemu_file_get_error(s->file)) {
|
||||||
migrate_fd_error(s);
|
migrate_fd_error(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
savevm.c
13
savevm.c
@ -425,7 +425,7 @@ QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer,
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemu_file_has_error(QEMUFile *f)
|
int qemu_file_get_error(QEMUFile *f)
|
||||||
{
|
{
|
||||||
return f->has_error;
|
return f->has_error;
|
||||||
}
|
}
|
||||||
@ -1536,7 +1536,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);
|
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) {
|
if (ret != 0) {
|
||||||
qemu_savevm_state_cancel(mon, f);
|
qemu_savevm_state_cancel(mon, f);
|
||||||
}
|
}
|
||||||
@ -1576,7 +1576,7 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = qemu_file_has_error(f);
|
ret = qemu_file_get_error(f);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
qemu_savevm_state_cancel(mon, f);
|
qemu_savevm_state_cancel(mon, f);
|
||||||
}
|
}
|
||||||
@ -1623,7 +1623,7 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
|
|||||||
|
|
||||||
qemu_put_byte(f, QEMU_VM_EOF);
|
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)
|
void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
|
||||||
@ -1664,7 +1664,7 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = qemu_file_has_error(f);
|
ret = qemu_file_get_error(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret && saved_vm_running)
|
if (!ret && saved_vm_running)
|
||||||
@ -1885,8 +1885,9 @@ out:
|
|||||||
g_free(le);
|
g_free(le);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_file_has_error(f))
|
if (qemu_file_get_error(f)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user