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>
This commit is contained in:
Michal Privoznik 2016-04-10 15:48:27 +02:00
parent c6e0fcce4c
commit c331f56b93

View File

@ -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,