diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2022-06-20 12:02:02 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2022-06-23 10:17:58 +0100 |
commit | f759d7050bd0ec34f45bc0d91800625a6938e203 (patch) | |
tree | 17483eca47eb6f3f56a071604b1c615ea7b8cbf5 /migration/qemu-file.c | |
parent | 0ae1f7f055d757c01ce3144a7041fa9341a3715b (diff) |
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
Diffstat (limited to 'migration/qemu-file.c')
-rw-r--r-- | migration/qemu-file.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 74f919de67..2f46873efd 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -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; |