search for: nbd_null_complet

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

2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...ailure"); diff --git a/lib/rw.c b/lib/rw.c index 8b736d3..9f2909b 100644 --- a/lib/rw.c +++ b/lib/rw.c @@ -48,9 +48,9 @@ nbd_unlocked_pread (struct nbd_handle *h, void *buf, size_t count, uint64_t offset, uint32_t flags) { int64_t cookie; + nbd_completion_callback c = NBD_NULL_COMPLETION; - cookie = nbd_unlocked_aio_pread (h, buf, count, offset, - NBD_NULL_COMPLETION, flags); + cookie = nbd_unlocked_aio_pread (h, buf, count, offset, &c, flags); if (cookie == -1) return -1; @@ -61,15 +61,14 @@ nbd_unlocked_pread (struct nbd_handle...
2019 Aug 14
1
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...check which 'closure' instances are used where, and if used as an OClosure, then rely on String.uppercase_ascii closure.cbname to generate the appropriate C macro. Or, since we know we only have one such type, it's even faster to just hard-code a one-line addition to libnbd.h: #define NBD_NULL_COMPLETION (nbd_completion_callback) { NULL } or maybe #define NBD_NULL_COMPLETION \ (nbd_completion_callback) { .callback = NULL, .user_data = NULL } depending on how likely it is that someone might be using our header with a compiler mode that warns on an initializer that doesn't fully specify e...
2020 Sep 07
4
[libnbd PATCH 0/2] Fix memory leak with closures
As promised in my earlier thread on libnbd completion callback question. Eric Blake (2): generator: Refactor handling of closures in unlocked functions generator: Free closures on failure docs/libnbd.pod | 2 +- generator/C.ml | 48 +++++++++++------ generator/C.mli | 1 + lib/debug.c | 7 +-- lib/opt.c | 31 ++++++-----
2023 May 30
2
[libnbd PATCH v3 04/22] states: Prepare to send 64-bit requests
...erver negotiated extended mode, we are ASSUMING that the server did NOT negotiate it, and therefore we are in violation of the spec if we send the flag over the wire anyways. We can flag all other API where it is inappropriate to ever use... > > > + if (nbd_aio_pread (nbd, buf, 512, 0, NBD_NULL_COMPLETION, > > + LIBNBD_CMD_FLAG_PAYLOAD_LEN) != -1) { > > + fprintf (stderr, "%s: test failed: " > > + "nbd_aio_pread did not fail with unexpected flag\n", > > + argv[0]); > > + exit (EXIT_FAILURE); > &...
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
On 8/13/19 5:36 PM, Richard W.M. Jones wrote: > The definition of functions that take a callback is changed so that > the callback and user_data are combined into a single structure, eg: > > int64_t nbd_aio_pread (struct nbd_handle *h, > void *buf, size_t count, uint64_t offset, > - int (*completion_callback) (/*..*/), void *user_data, > +
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...t;, argv[0], + nbd_get_error ()); + exit (EXIT_FAILURE); + } + + /* Issue back-to-back write requests, both large enough to block. Set up + * the second to auto-retire via callback. + */ + if ((cookie = nbd_aio_pwrite (nbd, buf, sizeof buf, 0, + NBD_NULL_COMPLETION, 0)) == -1) { + fprintf (stderr, "%s: test failed: first nbd_aio_pwrite: %s\n", argv[0], + nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_aio_pwrite (nbd, buf, sizeof buf, 0, + (nbd_completion_callback) { .callback = callback }, +...
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...()); > + exit (EXIT_FAILURE); > + } > + > + /* Issue back-to-back write requests, both large enough to block. Set up > + * the second to auto-retire via callback. > + */ > + if ((cookie = nbd_aio_pwrite (nbd, buf, sizeof buf, 0, > + NBD_NULL_COMPLETION, 0)) == -1) { > + fprintf (stderr, "%s: test failed: first nbd_aio_pwrite: %s\n", argv[0], > + nbd_get_error ()); > + exit (EXIT_FAILURE); > + } > + if (nbd_aio_pwrite (nbd, buf, sizeof buf, 0, > + (nbd_completion_callback) { ....