mirror of
https://github.com/mii443/qemu.git
synced 2025-12-06 20:48:25 +00: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:
committed by
Dr. David Alan Gilbert
parent
0ae1f7f055
commit
f759d7050b
@@ -74,34 +74,6 @@ static ssize_t channel_writev_buffer(void *opaque,
|
||||
}
|
||||
|
||||
|
||||
static ssize_t channel_get_buffer(void *opaque,
|
||||
uint8_t *buf,
|
||||
int64_t pos,
|
||||
size_t size,
|
||||
Error **errp)
|
||||
{
|
||||
QIOChannel *ioc = QIO_CHANNEL(opaque);
|
||||
ssize_t ret;
|
||||
|
||||
do {
|
||||
ret = qio_channel_read(ioc, (char *)buf, size, errp);
|
||||
if (ret < 0) {
|
||||
if (ret == QIO_CHANNEL_ERR_BLOCK) {
|
||||
if (qemu_in_coroutine()) {
|
||||
qio_channel_yield(ioc, G_IO_IN);
|
||||
} else {
|
||||
qio_channel_wait(ioc, G_IO_IN);
|
||||
}
|
||||
} else {
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
} while (ret == QIO_CHANNEL_ERR_BLOCK);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static QEMUFile *channel_get_input_return_path(void *opaque)
|
||||
{
|
||||
QIOChannel *ioc = QIO_CHANNEL(opaque);
|
||||
@@ -117,7 +89,6 @@ static QEMUFile *channel_get_output_return_path(void *opaque)
|
||||
}
|
||||
|
||||
static const QEMUFileOps channel_input_ops = {
|
||||
.get_buffer = channel_get_buffer,
|
||||
.get_return_path = channel_get_input_return_path,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user