[libvirt] [PATCH 02/10] Support callbacks on virStream APIs in remote driver client
Eric Blake
eblake at redhat.com
Mon Nov 1 17:50:01 UTC 2010
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101101/2bc9ee42/attachment-0001.sig>
More information about the libvir-list
mailing list