On Mon, Aug 12, 2019 at 11:00:01PM +0100, Richard W.M. Jones wrote:
On Mon, Aug 12, 2019 at 01:53:56PM -0500, Eric Blake wrote:
> We then have the design question of whether to make an OClosure type,
> where C has two functions nbd_aio_pread and nbd_aio_pread_callback for
> convenience, but where other languages have only a single nbd.aio_pread
> where the callback parameter is optional (the Closure type for
> pread_structured chunk and for block_status extent will still be
> mandatory; it is only the completion callback that is currently causing
> us twice the API because we are treating it as pseudo-optional). Or
> maybe we just require C clients of nbd_aio_pread to always provide
> parameters for callbacks, but document that the completion callback and
> free callback pointers may be NULL.
I'll try to see what OClosure (and then getting rid of the _callback
variants, adding to the non-callback variants OClosure) will look like
tomorrow.
I should say that while OClosure has the possibility of
solving the freeing problem for buffers and closures attached
to AIO commands, and may also be a good idea to get rid of the
*_callback variants, it doesn't solve the problem in general.
In particular there's no way to free the debug function
closure, which means it would be leaked in language bindings.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW