In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a case for having the free callback run even if there is no
registered callback:
nbd_aio_pread (nbd, buf, sizeof buf, 0,
(nbd_completion_callback) { .callback = NULL,
.free = completion_free },
0);
but the semantics of that are a bit weird. Why would you need to
"free" a callback which doesn't exist? Would it be correct for the
library to free the callback immediately, rather than after the
theoretical completion callback would have run?
Rich.