Re: [PATCH v2 26/38] remote_driver: Implement virStreamSkip

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

 




On 04/20/2017 06:01 AM, Michal Privoznik wrote:
> 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(+)
> 

Seems reasonable - would be affected by a flags argument though...

John

> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 6a2c6f6..6037e08 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -5683,6 +5683,34 @@ remoteStreamRecv(virStreamPtr st,
>      return remoteStreamRecvFlags(st, data, nbytes, 0);
>  }
>  
> +
> +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;
> @@ -5857,6 +5885,7 @@ static virStreamDriver remoteStreamDrv = {
>      .streamRecv = remoteStreamRecv,
>      .streamRecvFlags = remoteStreamRecvFlags,
>      .streamSend = remoteStreamSend,
> +    .streamSkip = remoteStreamSkip,
>      .streamFinish = remoteStreamFinish,
>      .streamAbort = remoteStreamAbort,
>      .streamEventAddCallback = remoteStreamEventAddCallback,
> 

--
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]
  Powered by Linux