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

Re: [libvirt] [PATCH v2 28/38] Introduce virNetClientStreamHoleSize




On 04/20/2017 06:01 AM, Michal Privoznik wrote:
> This function will fetch previously processed stream holes and
> return their sum.


Wait, what?  Huh? Well perhaps patch 25 makes a bit more sense now - at
least with respect to the usage of +=.... But I'm now beginning to
wonder if I've understood processing correctly.

I'm not quite understanding this whole sum of all the holes thing. I
thought much earlier patches were generating message queues for each
packet to be queued/dequeued and processed...

> 
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  src/libvirt_remote.syms      |  1 +
>  src/rpc/virnetclientstream.c | 15 +++++++++++++++
>  src/rpc/virnetclientstream.h |  4 ++++
>  3 files changed, 20 insertions(+)
> 
> diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
> index 6093613..f546647 100644
> --- a/src/libvirt_remote.syms
> +++ b/src/libvirt_remote.syms
> @@ -48,6 +48,7 @@ virNetClientStreamEOF;
>  virNetClientStreamEventAddCallback;
>  virNetClientStreamEventRemoveCallback;
>  virNetClientStreamEventUpdateCallback;
> +virNetClientStreamHoleSize;
>  virNetClientStreamMatches;
>  virNetClientStreamNew;
>  virNetClientStreamQueuePacket;
> diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
> index f687bfa..c773524 100644
> --- a/src/rpc/virnetclientstream.c
> +++ b/src/rpc/virnetclientstream.c
> @@ -548,6 +548,21 @@ virNetClientStreamSendSkip(virNetClientStreamPtr st,
>  }
>  
>  
> +int virNetClientStreamHoleSize(virNetClientPtr client ATTRIBUTE_UNUSED,
> +                               virNetClientStreamPtr st,
> +                               unsigned long long *length)

Uses older style... Will also be affected by a flags argument

> +{
> +    int ret = st->skipLength;

Now we have an int being assigned the sum of a bunch of ULL's?

> +
> +    if (length) {

length could have been passed as NULL - I thought we avoided that back
in virStreamHoleSize by:

+    virCheckNonNullArgReturn(length, -1);

yeah - I know better safe than sorry; however, if !length then should
this function succeed?

John

> +        *length = st->skipLength;
> +        st->skipLength = 0;
> +    }
> +
> +    return ret;
> +}
> +
> +
>  int virNetClientStreamEventAddCallback(virNetClientStreamPtr st,
>                                         int events,
>                                         virNetClientStreamEventCallback cb,
> diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
> index 2835066..9caa091 100644
> --- a/src/rpc/virnetclientstream.h
> +++ b/src/rpc/virnetclientstream.h
> @@ -66,6 +66,10 @@ int virNetClientStreamSendSkip(virNetClientStreamPtr st,
>                                 virNetClientPtr client,
>                                 unsigned long long length);
>  
> +int virNetClientStreamHoleSize(virNetClientPtr client,
> +                               virNetClientStreamPtr st,
> +                               unsigned long long *length);
> +
>  int virNetClientStreamEventAddCallback(virNetClientStreamPtr st,
>                                         int events,
>                                         virNetClientStreamEventCallback cb,
> 


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