search for: nbd_unlocked_

Displaying 18 results from an estimated 18 matches for "nbd_unlocked_".

2019 Jun 04
2
[PATCH libnbd] generator: Fix race condition when validating h->state.
...uot; */\n"; let tests = List.map ( function @@ -2842,8 +2841,6 @@ let generate_lib_api_c () = pr " }\n"; pr "\n" ); - if is_locked then - pr " pthread_mutex_lock (&h->lock);\n"; pr " ret = nbd_unlocked_%s (h" name; let argnames = List.flatten (List.map name_of_arg args) in List.iter (pr ", %s") argnames; -- 2.21.0
2020 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...useless in telling me why. generator/C.ml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generator/C.ml b/generator/C.ml index 4a0b45d..2c62d4e 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -542,13 +542,13 @@ let generate_lib_api_c () = pr " ret = nbd_unlocked_%s " name; print_arg_list ~wrap:true ~types:false ~handle:true args optargs; pr ";\n"; - if may_set_error then ( - pr "\n"; - print_trace_leave ret; - pr "\n" - ); + pr "\n"; if !need_out_label then pr "...
2019 May 30
3
[PATCH libnbd 0/2] Avoid lock and error overhead on some calls.
This works. I'm in the middle of testing whether there is any noticable benefit. Rich.
2019 Jun 04
0
Re: [PATCH libnbd] generator: Fix race condition when validating h->state.
...; > - if is_locked then > - pr " pthread_mutex_lock (&h->lock);\n"; but returning -1 without releasing the lock is wrong. I would expect a bit more change to keep the locking sane, but once that is in place, the patch does solve one race. > pr " ret = nbd_unlocked_%s (h" name; > let argnames = List.flatten (List.map name_of_arg args) in > List.iter (pr ", %s") argnames; > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2019 Aug 10
0
[PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
...ue -> value @@ -3720,6 +3735,11 @@ let generate_lib_api_c () = need_out_label := true | _ -> () ) args; + List.iter ( + function + | OFlags (n, flags) -> + print_flags_check n flags + ) optargs; (* Make the call. *) pr " ret = nbd_unlocked_%s " name; -- 2.22.0
2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...ernal functions, so that helpers in the call stack can modify the incoming pointer rather than their own copy. This patch is just preparatory, with no semantic change. The public API still passes closures by copy, but the generator then operates on the address of that closure through all internal nbd_unlocked_* functions, rather than making further copies through each additional function call. --- generator/C.ml | 35 ++++++++++++----------- generator/C.mli | 1 + lib/debug.c | 6 ++-- lib/opt.c | 26 ++++++++--------- lib/rw.c | 76 ++++++++++++++++++++++++-------------------------...
2019 Aug 10
1
Re: [PATCH libnbd 2/9] generator: Generalize OFlags.
On 8/10/19 8:02 AM, Richard W.M. Jones wrote: > In a future commit we want to add (non-optional) Flags arg. As a step > to doing this, generalize OFlags so it's not tied to just > NBD_CMD_FLAG_*. > > This does not change the C API. > > It does introduce a small change to the OCaml API -- putting related > flags into a submodule, basically renaming them. Note we
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...helpers in the call stack can modify the > incoming pointer rather than their own copy. > > This patch is just preparatory, with no semantic change. The public > API still passes closures by copy, but the generator then operates on > the address of that closure through all internal nbd_unlocked_* > functions, rather than making further copies through each additional > function call. > --- > generator/C.ml | 35 ++++++++++++----------- > generator/C.mli | 1 + > lib/debug.c | 6 ++-- > lib/opt.c | 26 ++++++++--------- > lib/rw.c | 76 +++++++++++...
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 ++++++-----
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...;\n"; - pr " switch (get_state (h))\n"; + pr " switch (get_next_state (h))\n"; pr " {\n"; List.iter ( fun ({ parsed = { state_enum; events } }) -> @@ -2576,7 +2577,7 @@ let generate_lib_states_c () = pr "const char *\n"; pr "nbd_unlocked_connection_state (struct nbd_handle *h)\n"; pr "{\n"; - pr " switch (get_state (h))\n"; + pr " switch (get_next_state (h))\n"; pr " {\n"; List.iter ( fun ({ comment; parsed = { display_name; state_enum } }) -> @@ -2842,6 +2843,33 @@...
2019 Jun 08
4
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055 v2 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067 v3: - Fix atomicly -> atomically in commit message. - Fix a comment. - Fix TOCTTOU: There is now an inline function generated called <name>_is_permitted_state, and this is called twice, first outside the
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
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...-> print_extern_and_define name args ret + fun (name, { args; optargs; ret }) -> + print_extern_and_define name args optargs ret ) handle_calls; List.iter ( fun (ns, ctxts) -> print_ns ns ctxts @@ -3529,8 +3544,8 @@ let generate_lib_unlocked_h () = pr "#define LIBNBD_UNLOCKED_H\n"; pr "\n"; List.iter ( - fun (name, { args; ret }) -> - print_extern ("unlocked_" ^ name) args ret + fun (name, { args; optargs; ret }) -> + print_extern ("unlocked_" ^ name) args optargs ret ) handle_calls; pr "\n";...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...k cb,\n"; + pr " void *user_data);\n"; pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n"; pr "\n"; List.iter ( @@ -3386,7 +3403,7 @@ let generate_lib_api_c () = pr " }\n" ); pr " ret = nbd_unlocked_%s (h" name; - let argnames = List.flatten (List.map name_of_arg args) in + let argnames = List.flatten (List.map c_name_of_arg args) in List.iter (pr ", %s") argnames; pr ");\n"; if permitted_states <> [] then @@ -3560,9 +3577,9 @@ are called is n...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
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 Aug 10
17
[PATCH libnbd 0/9] Add Enum and Flags types.
This largish series adds several new features to the generator. Enum maps to enumerated types (like enum in C). The only current use for this is replacing the nbd_set_tls (nbd, 0/1/2) parameter with LIBNBD_TLS_DISABLE, LIBNBD_TLS_ALLOW, LIBNBD_TLS_REQUIRE (and natural equivalents in other programming languages). Flags maps to any uint32_t bitmask. It is basically a non-optional, generalized
2019 Aug 09
4
[PATCH libnbd 0/2] generator: Preparatory changes to the generator.
These are some simplifications to the generator. They don't probably make much sense on their own, but they are preparatory to better handling of enums, and or'd lists of flags. Rich.