[PATCH RFC 22/48] remote_driver: Implement virStreamSkip

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

 



Now that we have RPC wrappers over VIR_NET_STREAM_SKIP 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@xxxxxxxxxx>
---
 src/remote/remote_driver.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9f084a1..2dc21d2 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5273,6 +5273,34 @@ remoteStreamRecv(virStreamPtr st,
     return remoteStreamRecv(st, data, nbytes);
 }
 
+
+static int
+remoteStreamSkip(virStreamPtr st,
+                 unsigned long long length)
+{
+    VIR_DEBUG("st=%p length=%llu", st, length);
+    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 = virNetClientStreamSendSkip(privst,
+                                    priv->client,
+                                    length);
+
+    remoteDriverLock(priv);
+    priv->localUses--;
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+
 struct remoteStreamCallbackData {
     virStreamPtr st;
     virStreamEventCallback cb;
@@ -5447,6 +5475,7 @@ static virStreamDriver remoteStreamDrv = {
     .streamRecv = remoteStreamRecv,
     .streamRecvFlags = remoteStreamRecvFlags,
     .streamSend = remoteStreamSend,
+    .streamSkip = remoteStreamSkip,
     .streamFinish = remoteStreamFinish,
     .streamAbort = remoteStreamAbort,
     .streamEventAddCallback = remoteStreamEventAddCallback,
-- 
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]