[Libguestfs] [PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
Eric Blake
eblake at redhat.com
Tue Jul 30 16:21:25 UTC 2019
On 7/30/19 10:36 AM, Richard W.M. Jones wrote:
> As discussed in this thread, the parameter is an invitation to write
> code with race conditions:
>
> https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00309
> ---
> +++ b/generator/generator
> @@ -1729,7 +1729,7 @@ C<nbd_pread>.";
> default_call with
> args = [ BytesPersistOut ("buf", "count"); UInt64 "offset";
> Closure { cbname="callback";
> - cbargs=[Int64 "cookie"; Mutable (Int "error")] };
> + cbargs=[Mutable (Int "error")] };
No trailing ; in cbargs=[]...
> @@ -1773,8 +1776,7 @@ documented in C<nbd_pread_structured>.";
> UInt "status";
> Mutable (Int "error"); ]};
> Closure { cbname="callback";
> - cbargs=[Int64 "cookie";
> - Mutable (Int "error"); ]};
> + cbargs=[Mutable (Int "error"); ]};
...but there is here. Pre-existing, and OCaml tolerates our
inconsistency, but it's probably nicer to uniformly skip the trailing ;.
> Flags "flags" ];
> ret = RInt64;
> permitted_states = [ Connected ];
> @@ -1782,8 +1784,11 @@ documented in C<nbd_pread_structured>.";
> longdesc = "\
> Issue a read command to the NBD server. This returns the
> unique positive 64 bit cookie for this command, or C<-1> on
> -error. If this command returns a cookie, then C<callback>
> +error.
> +
> +When the command completes, C<callback>
> will be invoked as described in L<libnbd(3)/Completion callbacks>.
> +
Do we need wording anywhere (probably in the .pod, so we only state it
once) that mentions that the callback routine is not invoked if
nbd_aio_FOO_callback returns -1?
ACK.
--
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/20190730/584801a6/attachment.sig>
More information about the Libguestfs
mailing list