[Libguestfs] [PATCH libnbd 5/7] ocaml: Use free callback to free closure root, instead of valid_flag == FREE.

Eric Blake eblake at redhat.com
Mon Aug 12 17:10:03 UTC 2019


On 8/12/19 11:08 AM, Richard W.M. Jones wrote:
> Instead of using the valid_flag == FREE mechanism, use a free callback
> to free each closure root.
> ---
>  generator/generator | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Looks like a straight swap; at this point in the series, valid_flag &
FREE is called exactly as many times as a free callback; and moving to a
free callback would mean a later patch could get rid of valid_flag if we
wanted (although that's a C API change).

Still, if we're able to reliably call the C nbd_aio_pread_callback even
from the OCaml nbd.aio_pread, then the valid_flag = FREE mechanism
results in fewer function calls than having to register a free callback
for each pointer to be cleaned up.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190812/460afad6/attachment.sig>


More information about the Libguestfs mailing list