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

[libvirt] [PATCH v3 22/31] Introduce virNetClientStreamRecvHole



This function will fetch previously processed stream holes and
return their sum.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 src/libvirt_remote.syms      |  1 +
 src/rpc/virnetclientstream.c | 16 ++++++++++++++++
 src/rpc/virnetclientstream.h |  4 ++++
 3 files changed, 21 insertions(+)

diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 186d2c622..61c20d530 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -52,6 +52,7 @@ virNetClientStreamMatches;
 virNetClientStreamNew;
 virNetClientStreamQueuePacket;
 virNetClientStreamRaiseError;
+virNetClientStreamRecvHole;
 virNetClientStreamRecvPacket;
 virNetClientStreamSendHole;
 virNetClientStreamSendPacket;
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 4a3d843b1..bf3922cb5 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -583,6 +583,22 @@ virNetClientStreamSendHole(virNetClientStreamPtr st,
 }
 
 
+int virNetClientStreamRecvHole(virNetClientPtr client ATTRIBUTE_UNUSED,
+                               virNetClientStreamPtr st,
+                               long long *length)
+{
+    if (!st->allowSkip) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("Holes are not supported with this stream"));
+        return -1;
+    }
+
+    *length = st->holeLength;
+    st->holeLength = 0;
+    return 0;
+}
+
+
 int virNetClientStreamEventAddCallback(virNetClientStreamPtr st,
                                        int events,
                                        virNetClientStreamEventCallback cb,
diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index 1774e5ac3..c4e01bf1c 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -67,6 +67,10 @@ int virNetClientStreamSendHole(virNetClientStreamPtr st,
                                long long length,
                                unsigned int flags);
 
+int virNetClientStreamRecvHole(virNetClientPtr client,
+                               virNetClientStreamPtr st,
+                               long long *length);
+
 int virNetClientStreamEventAddCallback(virNetClientStreamPtr st,
                                        int events,
                                        virNetClientStreamEventCallback cb,
-- 
2.13.0


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