search for: completion_callback

Displaying 20 results from an estimated 29 matches for "completion_callback".

2020 Sep 11
0
[libnbd PATCH v2 3/5] api: Add nbd_set_strict_mode
..._also = [Link "add_meta_context"; Link "can_meta_context"; - Link "aio_block_status"]; + Link "aio_block_status"; Link "set_strict_mode"]; }; "poll", { @@ -2088,9 +2166,10 @@ Or supply the optional C<completion_callback> which will be invoked as described in L<libnbd(3)/Completion callbacks>. Note that you must ensure C<buf> is valid until the command has -completed. Other parameters behave as documented in L<nbd_pwrite(3)>."; +completed. Other parameters behave as documented in L&lt...
2023 May 02
1
[libnbd PATCH v2 2/2] generator/C: lib/api.c: indent arg list 2 spaces relative to function name
...-5378,9 +5577,11 @@ aio_opt_list_meta_context_queries_in_per > } > > int > -nbd_aio_opt_list_meta_context_queries (struct nbd_handle *h, char **queries, > - nbd_context_callback context_callback, > - nbd_completion_callback completion_callback) > +nbd_aio_opt_list_meta_context_queries ( > + struct nbd_handle *h, char **queries, > + nbd_context_callback context_callback, > + nbd_completion_callback completion_callback > +) > { > bool p; > int ret; Bugzilla: https://bugzilla.redhat.com...
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...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, > + nbd_completion_callback completion_callback, > uint32_t flags); > > Several nbd_*_callback structures are defined. The one corresponding > to the example above is: > > typedef struct { > void *user_data; >...
2019 Aug 14
0
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...inition 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, > > + nbd_completion_callback completion_callback, > > uint32_t flags); > > > > Several nbd_*_callback structures are defined. The one corresponding > > to the example above is: > > > > typedef struct {...
2023 May 02
4
[libnbd PATCH v2 0/2] continue wrapping generated C code harder
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 v1: https://listman.redhat.com/archives/libguestfs/2023-April/031375.html In v2, move the declaration of the "p" helper variable next to the top of the function. Thanks! Laszlo Laszlo Ersek (2): generator/C: print_wrapper: use helper variable for permitted state check generator/C: lib/api.c: indent arg list 2
2019 Aug 13
1
Re: [PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
On 8/13/19 10:37 AM, Richard W.M. Jones wrote: > The original nbd_aio_* (non-callback) functions are removed and > replaced with the renamed callback variants. > > This is a simple mechanical change to the API: > > (1) Any existing call to nbd_aio_*_callback can simply be renamed to > nbd_aio_* > > (2) Any existing call to nbd_aio_* must have two extra NULL
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...Link "aio_pread_structured"; Link "get_block_size"]; + Link "aio_pread_structured"; Link "get_block_size"; + Link "set_strict_mode"]; }; "pwrite", { @@ -2123,10 +2149,12 @@ Or supply the optional C<completion_callback> which will be invoked as described in L<libnbd(3)/Completion callbacks>. Note that you must ensure C<buf> is valid until the command has -completed. Other parameters behave as documented in L<nbd_pread(3)>."; +completed. Other parameters behave as documented in L<...
2019 Aug 14
0
[PATCH libnbd 2/3] python: Hold a refcount to persistent AIO buffer until command completion.
...g to call it */\n" cbname + pr " %s_user_data->fn = NULL;\n" cbname | OFlags (n, _) -> pr " %s_u32 = %s;\n" n n ) optargs; + (* If there is a BytesPersistIn/Out parameter then we need to + * increment the refcount and save the pointer into + * completion_callback.user_data so we can decrement the + * refcount on command completion. + *) + List.iter ( + function + | BytesPersistIn (n, _) | BytesPersistOut (n, _) -> + pr " /* Increment refcount since buffer may be saved by libnbd. */\n"; + pr " Py_INCREF (%s);\n&quot...
2019 Aug 13
1
Re: [PATCH libnbd 4/6] lib: Check Closure parameter is not NULL.
...ebug handler? If it becomes a problem, we can improve the 'closure' type to take a bool argument stating whether the closure accepts NULL, defaulting to false, but set to true for debug_closure - or we could rewrite nbd_set_debug_callback to take an OClosure instead of a Closure). Requires completion_callback to be non-NULL, but we relax that restriction by moving to OClosure. ACK. Yes, the first four can be applied no matter what else we discuss. > diff --git a/generator/generator b/generator/generator > index 7f97163..01da1c3 100755 > --- a/generator/generator > +++ b/generator/generato...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...red"; Link "get_block_size"]; > + Link "aio_pread_structured"; Link "get_block_size"; > + Link "set_strict_mode"]; > }; > > "pwrite", { > @@ -2123,10 +2149,12 @@ Or supply the optional C<completion_callback> which will be invoked > as described in L<libnbd(3)/Completion callbacks>. > > Note that you must ensure C<buf> is valid until the command has > -completed. Other parameters behave as documented in L<nbd_pread(3)>."; > +completed. Other parameters beha...
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python: https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html plus adding the 590 asynch test at the end. Rich.
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2020 Aug 14
0
[libnbd PATCH v2 12/13] wip: api: Give aio_opt_go a completion callback
...t;nbd_set_export_name(3)>. This can only be used if L<nbd_set_opt_mode(3)> enabled option mode. To determine when the request completes, wait for -L<nbd_aio_is_connecting(3)> to return false."; +L<nbd_aio_is_connecting(3)> to return false. Or supply the optional +C<completion_callback> which will be invoked as described in +L<libnbd(3)/Completion callbacks>, except that it is automatically +retired regardless of return value. Note that detecting whether the +server returns an error (as is done by the return value of the +synchronous counterpart) is only possible with a...
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...n enum_prefix n @@ -5154,6 +5156,19 @@ let print_ocaml_binding (name, { args; optargs; ret }) = pr " uint64_t %s = Int64_val (%sv);\n" n n ) args; + (* If there is a BytesPersistIn/Out parameter then we need to + * register it as a global root and save that into the + * completion_callback.user_data so the root is removed on + * command completion. + *) + List.iter ( + function + | BytesPersistIn (n, _) | BytesPersistOut (n, _) -> + pr " completion_user_data->bufv = %sv;\n" n; + pr " caml_register_generational_global_root (&completion...
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...; - pr " %s.callback = NULL; /* we're not going to call it */\n" cbname - | OFlags (n, _) -> pr " %s_u32 = %s;\n" n n - ) optargs; - - (* If there is a BytesPersistIn/Out parameter then we need to - * increment the refcount and save the pointer into - * completion_callback.user_data so we can decrement the - * refcount on command completion. - *) - List.iter ( - function - | BytesPersistIn (n, _) | BytesPersistOut (n, _) -> - pr " /* Increment refcount since buffer may be saved by libnbd. */\n"; - pr " Py_INCREF (%s);\n&quot...
2020 Sep 28
0
[libnbd PATCH 3/3] api: Add nbd_opt_list_meta_context
...diff --git a/lib/internal.h b/lib/internal.h index cde5dcd..ad1eeb9 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -77,6 +77,7 @@ struct command_cb { nbd_extent_callback extent; nbd_chunk_callback chunk; nbd_list_callback list; + nbd_context_callback context; } fn; nbd_completion_callback completion; }; diff --git a/generator/API.ml b/generator/API.ml index 938ace4..358ec38 100644 --- a/generator/API.ml +++ b/generator/API.ml @@ -142,8 +142,13 @@ let list_closure = { cbname = "list"; cbargs = [ CBString "name"; CBString "description" ] } +let co...
2023 Jul 13
2
[libnbd PATCH 0/2] Fix docs and testing of completion callback
This is my proposal for fixing the documentation to match practice (namely, that completion.callback is not invoked in the cases where the aio call itself reports errors); we could instead try to go the other direction and tweak the generator to guarantee that both completion.callback and completion.free are reached no matter what, but that felt more invasive to me. Eric Blake (2): api: Tighten
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
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, + nbd_completion_callback completion_callback, uint32_t flags); Several nbd_*_callback structures are defined. The one corresponding to the example above is: typedef struct { void *user_data; int (*callback) (unsigned valid_flag, void *...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
...t the C level, even if the OCaml program didn't use the optional argument. That's because the free callback doesn't run otherwise. There is a case for having the free callback run even if there is no registered callback: nbd_aio_pread (nbd, buf, sizeof buf, 0, (nbd_completion_callback) { .callback = NULL, .free = completion_free }, 0); but the semantics of that are a bit weird. Why would you need to "free" a callback which doesn't exist? Would it be correct for the library to free the callback immedia...
2020 Sep 28
8
[libnbd PATCH 0/3] opt_list_meta_context
I'm posting this now, as I'm at the end of a workday and I got things working for manual experimentation. Still to do: - write interop tests for qemu-nbd and nbdkit (including my proposed patch addition of qemu-nbd -A to show qemu:allocation-depth) - figure out if we can make 'nbdinfo --map' use the new API to automatically select all contexts advertised by the server Eric Blake