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(a)redhat.com>
---
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 8141c2a..f0e85ce 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5127,6 +5127,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;
@@ -5301,6 +5329,7 @@ static virStreamDriver remoteStreamDrv = {
.streamRecv = remoteStreamRecv,
.streamRecvFlags = remoteStreamRecvFlags,
.streamSend = remoteStreamSend,
+ .streamSkip = remoteStreamSkip,
.streamFinish = remoteStreamFinish,
.streamAbort = remoteStreamAbort,
.streamEventAddCallback = remoteStreamEventAddCallback,
--
2.8.3