mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qemu-file: remove shutdown member
The first thing that we do after setting the shutdown value is set the error as -EIO if there is not a previous error. So this value is redundant. Just remove it and use qemu_file_get_error() in the places that it was tested. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Message-Id: <20230504113841.23130-7-quintela@redhat.com>
This commit is contained in:
parent
27a1243f14
commit
ac7d25b816
1 changed files with 3 additions and 7 deletions
|
@ -63,8 +63,6 @@ struct QEMUFile {
|
||||||
|
|
||||||
int last_error;
|
int last_error;
|
||||||
Error *last_error_obj;
|
Error *last_error_obj;
|
||||||
/* has the file has been shutdown */
|
|
||||||
bool shutdown;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,8 +76,6 @@ int qemu_file_shutdown(QEMUFile *f)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
f->shutdown = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must set qemufile error before the real shutdown(), otherwise
|
* We must set qemufile error before the real shutdown(), otherwise
|
||||||
* there can be a race window where we thought IO all went though
|
* there can be a race window where we thought IO all went though
|
||||||
|
@ -294,7 +290,7 @@ void qemu_fflush(QEMUFile *f)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->shutdown) {
|
if (qemu_file_get_error(f)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (f->iovcnt > 0) {
|
if (f->iovcnt > 0) {
|
||||||
|
@ -397,7 +393,7 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile *f)
|
||||||
f->buf_index = 0;
|
f->buf_index = 0;
|
||||||
f->buf_size = pending;
|
f->buf_size = pending;
|
||||||
|
|
||||||
if (f->shutdown) {
|
if (qemu_file_get_error(f)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +482,7 @@ static int add_to_iovec(QEMUFile *f, const uint8_t *buf, size_t size,
|
||||||
} else {
|
} else {
|
||||||
if (f->iovcnt >= MAX_IOV_SIZE) {
|
if (f->iovcnt >= MAX_IOV_SIZE) {
|
||||||
/* Should only happen if a previous fflush failed */
|
/* Should only happen if a previous fflush failed */
|
||||||
assert(f->shutdown || !qemu_file_is_writable(f));
|
assert(qemu_file_get_error(f) || !qemu_file_is_writable(f));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (may_free) {
|
if (may_free) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue