mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
io: add qio_channel_readv_full_all_eof & qio_channel_readv_full_all helpers
Adds qio_channel_readv_full_all_eof() and qio_channel_readv_full_all() to read both data and FDs. Refactors existing code to use these helpers. Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com> Signed-off-by: John G Johnson <john.g.johnson@oracle.com> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Acked-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: b059c4cc0fb741e794d644c144cc21372cad877d.1611938319.git.jag.raman@oracle.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
bfa4238750
commit
bebab91ebd
2 changed files with 134 additions and 20 deletions
|
@ -777,6 +777,59 @@ void qio_channel_set_aio_fd_handler(QIOChannel *ioc,
|
|||
IOHandler *io_write,
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* qio_channel_readv_full_all_eof:
|
||||
* @ioc: the channel object
|
||||
* @iov: the array of memory regions to read data to
|
||||
* @niov: the length of the @iov array
|
||||
* @fds: an array of file handles to read
|
||||
* @nfds: number of file handles in @fds
|
||||
* @errp: pointer to a NULL-initialized error object
|
||||
*
|
||||
*
|
||||
* Performs same function as qio_channel_readv_all_eof.
|
||||
* Additionally, attempts to read file descriptors shared
|
||||
* over the channel. The function will wait for all
|
||||
* requested data to be read, yielding from the current
|
||||
* coroutine if required. data refers to both file
|
||||
* descriptors and the iovs.
|
||||
*
|
||||
* Returns: 1 if all bytes were read, 0 if end-of-file
|
||||
* occurs without data, or -1 on error
|
||||
*/
|
||||
|
||||
int qio_channel_readv_full_all_eof(QIOChannel *ioc,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
int **fds, size_t *nfds,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* qio_channel_readv_full_all:
|
||||
* @ioc: the channel object
|
||||
* @iov: the array of memory regions to read data to
|
||||
* @niov: the length of the @iov array
|
||||
* @fds: an array of file handles to read
|
||||
* @nfds: number of file handles in @fds
|
||||
* @errp: pointer to a NULL-initialized error object
|
||||
*
|
||||
*
|
||||
* Performs same function as qio_channel_readv_all_eof.
|
||||
* Additionally, attempts to read file descriptors shared
|
||||
* over the channel. The function will wait for all
|
||||
* requested data to be read, yielding from the current
|
||||
* coroutine if required. data refers to both file
|
||||
* descriptors and the iovs.
|
||||
*
|
||||
* Returns: 0 if all bytes were read, or -1 on error
|
||||
*/
|
||||
|
||||
int qio_channel_readv_full_all(QIOChannel *ioc,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
int **fds, size_t *nfds,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* qio_channel_writev_full_all:
|
||||
* @ioc: the channel object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue