mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
migration: remove the QEMUFileOps 'writev_buffer' callback
This directly implements the writev_buffer logic using QIOChannel APIs. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
f759d7050b
commit
ec2135eec8
3 changed files with 8 additions and 68 deletions
|
@ -248,10 +248,6 @@ static void qemu_iovec_release_ram(QEMUFile *f)
|
|||
*/
|
||||
void qemu_fflush(QEMUFile *f)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
ssize_t expect = 0;
|
||||
Error *local_error = NULL;
|
||||
|
||||
if (!qemu_file_is_writable(f)) {
|
||||
return;
|
||||
}
|
||||
|
@ -260,22 +256,18 @@ void qemu_fflush(QEMUFile *f)
|
|||
return;
|
||||
}
|
||||
if (f->iovcnt > 0) {
|
||||
expect = iov_size(f->iov, f->iovcnt);
|
||||
ret = f->ops->writev_buffer(f->ioc, f->iov, f->iovcnt,
|
||||
f->total_transferred, &local_error);
|
||||
Error *local_error = NULL;
|
||||
if (qio_channel_writev_all(f->ioc,
|
||||
f->iov, f->iovcnt,
|
||||
&local_error) < 0) {
|
||||
qemu_file_set_error_obj(f, -EIO, local_error);
|
||||
} else {
|
||||
f->total_transferred += iov_size(f->iov, f->iovcnt);
|
||||
}
|
||||
|
||||
qemu_iovec_release_ram(f);
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
f->total_transferred += ret;
|
||||
}
|
||||
/* We expect the QEMUFile write impl to send the full
|
||||
* data set we requested, so sanity check that.
|
||||
*/
|
||||
if (ret != expect) {
|
||||
qemu_file_set_error_obj(f, ret < 0 ? ret : -EIO, local_error);
|
||||
}
|
||||
f->buf_index = 0;
|
||||
f->iovcnt = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue