mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
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:
parent
c6e0fcce4c
commit
c331f56b93
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user