[PATCH RFC 06/48] Implement virStreamRecvFlags to some drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have three virStreamDriver-s currently in our tree.
virFDStream, remote driver and ESX driver.f or now, support for
remote driver and ESX driver is sufficient, because
implementation for virFDStream is going to be supplied later as
it needs to be slightly different.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/esx/esx_stream.c       | 16 +++++++++++++++-
 src/remote/remote_driver.c | 21 +++++++++++++++++----
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c
index fb9abbc..b820b38 100644
--- a/src/esx/esx_stream.c
+++ b/src/esx/esx_stream.c
@@ -252,12 +252,17 @@ esxStreamSend(virStreamPtr stream, const char *data, size_t nbytes)
 }
 
 static int
-esxStreamRecv(virStreamPtr stream, char *data, size_t nbytes)
+esxStreamRecvFlags(virStreamPtr stream,
+                   char *data,
+                   size_t nbytes,
+                   unsigned int flags)
 {
     int result = -1;
     esxStreamPrivate *priv = stream->privateData;
     int status;
 
+    virCheckFlags(0, -1);
+
     if (nbytes == 0)
         return 0;
 
@@ -317,6 +322,14 @@ esxStreamRecv(virStreamPtr stream, char *data, size_t nbytes)
     return result;
 }
 
+static int
+esxStreamRecv(virStreamPtr stream,
+              char *data,
+              size_t nbytes)
+{
+    return esxStreamRecvFlags(stream, data, nbytes, 0);
+}
+
 static void
 esxFreeStreamPrivate(esxStreamPrivate **priv)
 {
@@ -369,6 +382,7 @@ esxStreamAbort(virStreamPtr stream)
 virStreamDriver esxStreamDriver = {
     .streamSend = esxStreamSend,
     .streamRecv = esxStreamRecv,
+    .streamRecvFlags = esxStreamRecvFlags,
     /* FIXME: streamAddCallback missing */
     /* FIXME: streamUpdateCallback missing */
     /* FIXME: streamRemoveCallback missing */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 3f9d812..bfd8e8e 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5231,15 +5231,19 @@ remoteStreamSend(virStreamPtr st,
 
 
 static int
-remoteStreamRecv(virStreamPtr st,
-                 char *data,
-                 size_t nbytes)
+remoteStreamRecvFlags(virStreamPtr st,
+                      char *data,
+                      size_t nbytes,
+                      unsigned int flags)
 {
-    VIR_DEBUG("st=%p data=%p nbytes=%zu", st, data, nbytes);
+    VIR_DEBUG("st=%p data=%p nbytes=%zu flags=%x",
+              st, data, nbytes, flags);
     struct private_data *priv = st->conn->privateData;
     virNetClientStreamPtr privst = st->privateData;
     int rv;
 
+    virCheckFlags(0, -1);
+
     if (virNetClientStreamRaiseError(privst))
         return -1;
 
@@ -5261,6 +5265,14 @@ remoteStreamRecv(virStreamPtr st,
     return rv;
 }
 
+static int
+remoteStreamRecv(virStreamPtr st,
+                 char *data,
+                 size_t nbytes)
+{
+    return remoteStreamRecv(st, data, nbytes);
+}
+
 struct remoteStreamCallbackData {
     virStreamPtr st;
     virStreamEventCallback cb;
@@ -5433,6 +5445,7 @@ remoteStreamAbort(virStreamPtr st)
 
 static virStreamDriver remoteStreamDrv = {
     .streamRecv = remoteStreamRecv,
+    .streamRecvFlags = remoteStreamRecvFlags,
     .streamSend = remoteStreamSend,
     .streamFinish = remoteStreamFinish,
     .streamAbort = remoteStreamAbort,
-- 
2.8.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]