search for: nbd_add_close_callback

Displaying 20 results from an estimated 37 matches for "nbd_add_close_callback".

2019 Jul 16
2
[PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
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...
2019 Jul 16
2
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
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, >>...
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
We previously needed nbd_add_close_callback to do cleanup from language bindings. However now we have closure lifetimes this is no longer needed and can be removed. See also: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html --- generator/generator | 18 ------------------ lib/handle.c | 35 ------------------------...
2019 Jul 16
0
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
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, > >>...
2019 Jul 16
0
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
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, >...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...| Flags n -> pr "uint32_t %s" n | Int n -> pr "int %s" n | Int64 n -> pr "int64_t %s" n @@ -3305,8 +3306,8 @@ let generate_include_libnbd_h () = pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; - pr " void *user_data,\n"; - pr " nbd_close_callback cb);\n"; + pr " nbd_close_callback cb,\n"; + pr "...
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE ** This is the generator change as discussed on the list already. The Python and OCaml bindings are not yet done. It passes all [C only] tests and valgrind. Note that nbd_add_close_callback is inconsistent with other closure types because it passes the user_data parameter after the function. (This is not caused by the current patch, it was already inconsistent). We decided that nbd_add_close_callback should be manually generated and not automatically generated because it should only...
2019 Jul 17
0
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...dings, right now we have to malloc() a C structure that tracks the Python Callable associated with any Closure, and currently don't free that C struct until nbd_close. Basically, we have: nbd_internal_py_aio_pread_structured data = malloc() nbd_aio_pread_structured(, chunk_wrapper, data) nbd_add_close_callback(data_free, data) nbd_internal_py_aio_pread_structured_callback data = malloc() nbd_aio_pread_structured_callback(, chunk_wrapper, callback_wrapper, data) nbd_add_close_callback(data_free, data) where there is no convenient way for the generator to insert cleanup for the data malloc'd in...
2019 Jul 17
2
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
On 7/17/19 8:00 AM, Richard W.M. Jones wrote: > --- > .gitignore | 1 + > README | 2 + > configure.ac | 9 + > examples/Makefile.am | 22 ++ > examples/glib-main-loop.c | 511 ++++++++++++++++++++++++++++++++++++++ > 5 files changed, 545 insertions(+) Looks good. > > + revents = g_source_query_unix_fd
2019 Jul 20
2
[libnbd] More thoughts on callbacks and more
..._free_set_debug_callback_debug_fn corresponding to the debug_fn arg of nbd_set_debug_callback. Luckily they can all be generated along with the internal machinery to call them. Buffer lifetimes ---------------- Similar to the above, persistent buffers (BytesPersist*) can have lifetimes. Remove nbd_add_close_callback ----------------------------- The above changes (actually, just the closure change) lets us remove nbd_add_close_callback. Fixing callback / cookie problem -------------------------------- I think an easier way to fix this would be to simply detect the problematic situation and queue up the call...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...;; pr "extern const char *nbd_get_error (void);\n"; + pr "#define LIBNBD_HAVE_NBD_GET_ERROR 1\n"; + pr "\n"; pr "extern int nbd_get_errno (void);\n"; + pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; + pr "\n"; pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; pr " nbd_close_callback cb, void *data);\n"; + pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n"; pr "\n"; List.iter ( - fun (name, { args; ret }) -> print_extern name args ret + fun...
2019 Aug 11
3
[PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
This adds a C-only semi-private function for freeing various types of persistent data passed to libnbd. There are some similarities with nbd_add_close_callback which we removed in commit 7f191b150b52ed50098976309a6af883d245fc56. --- generator/generator | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/generator/generator b/generator/generator index 55c4dfc..0ea6b61 100755 --- a/generator/generator +++ b/ge...
2019 Jul 11
1
Re: [libnbd] Slight API inconsistency
On Thu, Jul 11, 2019 at 09:35:02AM -0500, Eric Blake wrote: >On 7/11/19 9:23 AM, Martin Kletzander wrote: >> The callback (e.g. for `nbd_block_status`) now has a support for returning >> errors thanks to the last parameter (`int *error`), so it was switched to >> returning void. > >No, the callback still returns int. Where are you seeing it return >void, because
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...n"; pr "\n"; List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants; pr "\n"; @@ -3275,7 +3291,8 @@ let generate_include_libnbd_h () = pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; - pr " nbd_close_callback cb, void *data);\n"; + pr " nbd_close_callback cb,\n"; + pr " void *user_data);\n"; pr "#define LI...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review. Some of the highlights: - Callbacks should be freed reliably along all exit paths. - There's a simple test of closure lifetimes. - I've tried to use VALID|FREE in all the places where I'm confident that it's safe and correct to do. There may be more places. Note this is an optimization and shouldn't
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD. Rich.
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...sIn (n, _) -> pr " PyBuffer_Release (&%s);\n" n | BytesPersistIn _ | BytesOut _ | BytesPersistOut _ -> () - | Callback _ -> () - | CallbackPersist (n, _) -> - pr " /* This ensures the callback data is freed eventually. */\n"; - pr " nbd_add_close_callback (h, free, %s_data);\n" n | Flags _ -> () | Int _ -> () | Int64 _ -> () | Mutable _ -> () - | Opaque _ -> () + | OpaqueAndCallbacks _ -> () + | OpaqueAndCallbacksPersist (n, _) -> + pr " /* This ensures the callback data is freed eve...
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Aug 12
0
Re: [PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
On 8/11/19 8:03 AM, Richard W.M. Jones wrote: > This adds a C-only semi-private function for freeing various types of > persistent data passed to libnbd. > > There are some similarities with nbd_add_close_callback which we > removed in commit 7f191b150b52ed50098976309a6af883d245fc56. > --- > generator/generator | 46 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/generator/generator b/generator/generator > index 55c4dfc..0ea6b61 100755...