search for: nbd_null_callback

Displaying 7 results from an estimated 7 matches for "nbd_null_callback".

2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...= my_fn, .user_data = my_data }, 0); Note that the whole structure is passed by value not by reference. For OClosure only, a NULL callback can be passed using this macro: nbd_aio_pread (nbd, buf, sizeof buf, offset, NBD_NULL_CALLBACK(completion), 0); --- docs/libnbd.pod | 27 ++++++--- examples/batched-read-write.c | 5 +- examples/glib-main-loop.c | 6 +- examples/strict-structured-reads.c | 3 +- examples/threaded-reads-and-writes.c | 6 +- generator/generator | 8...
2019 Aug 14
1
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...hed-read-write.c >>> @@ -53,12 +53,13 @@ try_deadlock (void *arg) >>> >>> /* Issue commands. */ >>> cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, >>> - NULL, NULL, 0); >>> + NBD_NULL_CALLBACK(completion), 0); >> >> A bit more verbose, but the macro cuts it down from something even >> longer to type. I can live with this conversion. > > I was trying to write a generic macro (ie. just ‘NBD_NULL_CALLBACK’) > for this, but I don't believe it's possible....
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...L fn in libnbd-api.3). > +++ b/examples/batched-read-write.c > @@ -53,12 +53,13 @@ try_deadlock (void *arg) > > /* Issue commands. */ > cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, > - NULL, NULL, 0); > + NBD_NULL_CALLBACK(completion), 0); A bit more verbose, but the macro cuts it down from something even longer to type. I can live with this conversion. > +++ b/examples/glib-main-loop.c > @@ -384,7 +384,8 @@ read_data (gpointer user_data) > > if (nbd_aio_pread (gssrc->nbd, buffers[i].data, >...
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is
2019 Aug 14
0
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...++ b/examples/batched-read-write.c > > @@ -53,12 +53,13 @@ try_deadlock (void *arg) > > > > /* Issue commands. */ > > cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, > > - NULL, NULL, 0); > > + NBD_NULL_CALLBACK(completion), 0); > > A bit more verbose, but the macro cuts it down from something even > longer to type. I can live with this conversion. I was trying to write a generic macro (ie. just ‘NBD_NULL_CALLBACK’) for this, but I don't believe it's possible. > > +++ b/examples/...
2019 Aug 14
1
Re: [PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...malloc (...); > + > + nbd_aio_pread_structured (nbd, buf, sizeof buf, offset, > + (nbd_chunk_callback) { .callback = my_fn, > + .user_data = my_data, > + .free = free }, > + NBD_NULL_CALLBACK(completion), Needs rebasing based on the tweak to patch 1. > diff --git a/examples/strict-structured-reads.c b/examples/strict-structured-reads.c > static int > -read_verify (unsigned valid_flag, void *opaque, int *error) > +read_verify (void *opaque, int *error) > { > in...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...CK_VALID> + void *my_data = malloc (...); + + nbd_aio_pread_structured (nbd, buf, sizeof buf, offset, + (nbd_chunk_callback) { .callback = my_fn, + .user_data = my_data, + .free = free }, + NBD_NULL_CALLBACK(completion), + 0); -The callback parameters are valid and this is a normal callback. +will call L<free(3)> on C<my_data> after the last time that the +S<C<chunk.callback = my_fn>> function is called. -=item C<LIBNBD_CALLBACK_FREE> - -This is the last...