[Libguestfs] [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.

Eric Blake eblake at redhat.com
Tue Jul 16 16:38:36 UTC 2019


On 7/16/19 10:39 AM, Eric Blake wrote:
> On 7/16/19 10:04 AM, Richard W.M. Jones wrote:
>> The API changes from:
>>
>>   int nbd_add_close_callback (struct nbd_handle *h,
>>                               nbd_close_callback cb,
>>                               void *user_data);
>>
>> to:
>>
>>   int nbd_add_close_callback (struct nbd_handle *h,
>>                               void *user_data,
>>                               nbd_close_callback cb);
>>
>> The second way is consistent with how other callbacks work throughout
>> the API (ie. having the user_data passed first).
>> ---
>>  generator/generator | 10 +++++-----
>>  lib/handle.c        |  2 +-
>>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> ACK.
> 

A bit of bike-shedding:

In libc, we have qsort_r() which takes the function pointer before the
opaque data.

I'm trying to find other common frameworks that have common Closure
conventions, to see if we should instead swap our nbd_aio_FOO functions
to take user_data after the function pointers, instead of this switch to
the nbd_add_close_callback parameter order.


-- 
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/20190716/c06b2a76/attachment.sig>


More information about the Libguestfs mailing list