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

[libvirt] [PATCH v3 20/31] remote_driver: Implement virStreamSendHole



Now that we have RPC wrappers over VIR_NET_STREAM_HOLE we can
start wiring them up. This commit wires up situation when a
client wants to send a hole to daemon.

To keep stream offsets synchronous, upon successful call on the
daemon skip the same hole in local part of the stream.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 src/remote/remote_driver.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index aebdd47c9..ff5be6ebb 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5683,6 +5683,37 @@ remoteStreamRecv(virStreamPtr st,
     return remoteStreamRecvFlags(st, data, nbytes, 0);
 }
 
+
+static int
+remoteStreamSendHole(virStreamPtr st,
+                     long long length,
+                     unsigned int flags)
+{
+    VIR_DEBUG("st=%p length=%lld flags=%x",
+              st, length, flags);
+    struct private_data *priv = st->conn->privateData;
+    virNetClientStreamPtr privst = st->privateData;
+    int rv;
+
+    if (virNetClientStreamRaiseError(privst))
+        return -1;
+
+    remoteDriverLock(priv);
+    priv->localUses++;
+    remoteDriverUnlock(priv);
+
+    rv = virNetClientStreamSendHole(privst,
+                                    priv->client,
+                                    length,
+                                    flags);
+
+    remoteDriverLock(priv);
+    priv->localUses--;
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+
 struct remoteStreamCallbackData {
     virStreamPtr st;
     virStreamEventCallback cb;
@@ -5857,6 +5888,7 @@ static virStreamDriver remoteStreamDrv = {
     .streamRecv = remoteStreamRecv,
     .streamRecvFlags = remoteStreamRecvFlags,
     .streamSend = remoteStreamSend,
+    .streamSendHole = remoteStreamSendHole,
     .streamFinish = remoteStreamFinish,
     .streamAbort = remoteStreamAbort,
     .streamEventAddCallback = remoteStreamEventAddCallback,
-- 
2.13.0


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