mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
migration: remove the QEMUFileOps 'get_buffer' callback
This directly implements the get_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> dgilbert: Fixup len = *-*EIO as spotted by Peter Xu
This commit is contained in:
parent
0ae1f7f055
commit
f759d7050b
3 changed files with 16 additions and 40 deletions
|
@ -377,8 +377,22 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
|
|||
return 0;
|
||||
}
|
||||
|
||||
len = f->ops->get_buffer(f->ioc, f->buf + pending, f->total_transferred,
|
||||
IO_BUF_SIZE - pending, &local_error);
|
||||
do {
|
||||
len = qio_channel_read(f->ioc,
|
||||
(char *)f->buf + pending,
|
||||
IO_BUF_SIZE - pending,
|
||||
&local_error);
|
||||
if (len == QIO_CHANNEL_ERR_BLOCK) {
|
||||
if (qemu_in_coroutine()) {
|
||||
qio_channel_yield(f->ioc, G_IO_IN);
|
||||
} else {
|
||||
qio_channel_wait(f->ioc, G_IO_IN);
|
||||
}
|
||||
} else if (len < 0) {
|
||||
len = -EIO;
|
||||
}
|
||||
} while (len == QIO_CHANNEL_ERR_BLOCK);
|
||||
|
||||
if (len > 0) {
|
||||
f->buf_size += len;
|
||||
f->total_transferred += len;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue