Re: [PATCH 02/10] Support callbacks on virStream APIs in remote driver client

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

 



On 11/01/2010 10:11 AM, Daniel P. Berrange wrote:
> The current remote driver code for streams only supports
> blocking I/O mode. This is fine for the usage with migration
> but is a problem for more general use cases, in particular
> bi-directional streams.
> 
> This adds supported for the stream callbacks and non-blocking
> I/O. with the minor caveat is that it doesn't actually do
> non-blocking I/O for sending stream data, only receiving it.
> A future patch will try to do non-blocking sends, but this is
> quite tricky to get right.
> 
> * src/remote/remote_driver.c: Allow non-blocking I/O for
>   streams and support callbacks

> +
> +static void
> +remoteStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
> +{
> +    virStreamPtr st = opaque;
> +    struct private_data *priv = st->conn->privateData;
> +    struct private_stream_data *privst = st->privateData;
> +
> +    remoteDriverLock(priv);
> +    if (privst->cb &&
> +        (privst->cbEvents & VIR_STREAM_EVENT_READABLE) &&
> +        privst->incomingOffset) {
> +        virStreamEventCallback cb = privst->cb;
> +        void *cbOpaque = privst->cbOpaque;
> +        virFreeCallback cbFree = privst->cbFree;
> +
> +        privst->cbDispatch = 1;
> +        remoteDriverUnlock(priv);
> +        (cb)(st, VIR_STREAM_EVENT_READABLE, cbOpaque);

Any reason you aren't using the simpler style?

  cp(st, ...);

But not a show-stopper.  Looks good to me, so

ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]