aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorElena Ufimtseva <elena.ufimtseva@oracle.com>2021-01-29 11:46:08 -0500
committerStefan Hajnoczi <stefanha@redhat.com>2021-02-10 09:23:28 +0000
commitbfa42387505168782ba7b339d0b13c23648e6207 (patch)
treeb872fcb018a90ac29d47e240fa1c896e48d7ab0c /io
parent3f0e7e57a343ff8c041f47df108aa795fbf27fb3 (diff)
io: add qio_channel_writev_full_all helper
Adds qio_channel_writev_full_all() to transmit both data and FDs. Refactors existing code to use this helper. 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> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 480fbf1fe4152495d60596c9b665124549b426a5.1611938319.git.jag.raman@oracle.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'io')
-rw-r--r--io/channel.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/io/channel.c b/io/channel.c
index 93d449dee2..0d4b8b5160 100644
--- a/io/channel.c
+++ b/io/channel.c
@@ -157,6 +157,15 @@ int qio_channel_writev_all(QIOChannel *ioc,
size_t niov,
Error **errp)
{
+ return qio_channel_writev_full_all(ioc, iov, niov, NULL, 0, errp);
+}
+
+int qio_channel_writev_full_all(QIOChannel *ioc,
+ const struct iovec *iov,
+ size_t niov,
+ int *fds, size_t nfds,
+ Error **errp)
+{
int ret = -1;
struct iovec *local_iov = g_new(struct iovec, niov);
struct iovec *local_iov_head = local_iov;
@@ -168,7 +177,8 @@ int qio_channel_writev_all(QIOChannel *ioc,
while (nlocal_iov > 0) {
ssize_t len;
- len = qio_channel_writev(ioc, local_iov, nlocal_iov, errp);
+ len = qio_channel_writev_full(ioc, local_iov, nlocal_iov, fds, nfds,
+ errp);
if (len == QIO_CHANNEL_ERR_BLOCK) {
if (qemu_in_coroutine()) {
qio_channel_yield(ioc, G_IO_OUT);
@@ -182,6 +192,9 @@ int qio_channel_writev_all(QIOChannel *ioc,
}
iov_discard_front(&local_iov, &nlocal_iov, len);
+
+ fds = NULL;
+ nfds = 0;
}
ret = 0;