On Tue, Jul 16, 2019 at 11:38:36AM -0500, Eric Blake wrote:
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.
I don't really mind except to say we should do it consistently one way
or the other, and we should decide which way to do it fairly soon :-)
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