search for: print_trace_leave

Displaying 6 results from an estimated 6 matches for "print_trace_leave".

2020 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...-- 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 " out:\n"; + if may_set_error then ( + print_trace_leave ret; + pr "\n" + ); if is_locked then ( pr " if (h->public_state != get_next_state (...
2019 Nov 02
1
[PATCH libnbd] lib: Use GCC hints to move debug and error handling code out of hot paths.
...alue for flag: %%d\",\n"; pr " \"%s\", %s);\n" n n; pr " ret = %s;\n" value; @@ -4658,7 +4658,7 @@ let generate_lib_api_c () = pr ");\n" (* Print the trace when we leave a call with debugging enabled. *) and print_trace_leave ret = - pr " if (h->debug) {\n"; + pr " if_debug (h) {\n"; let errcode = errcode_of_ret ret in (match errcode with | Some r -> diff --git a/lib/crypto.c b/lib/crypto.c index 07d06c0..8d86911 100644 --- a/lib/crypto.c +++ b/lib/crypto.c @@ -676,7 +6...
2020 Sep 07
0
[libnbd PATCH 2/2] generator: Free closures on failure
.... +libnbd, including in the case where the API fails. This can be used to free associated C<user_data>. For example: diff --git a/generator/C.ml b/generator/C.ml index 280b319..4bdcf60 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -553,6 +553,19 @@ let generate_lib_api_c () = print_trace_leave ret; pr "\n" ); + (* Finish any closures not transferred to state machine. *) + List.iter ( + function + | Closure { cbname } -> + pr " FREE_CALLBACK (%s_callback);\n" cbname + | _ -> () + ) args; + List.iter ( + functio...
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 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...| StringList n -> () | UInt n | UInt32 n | UInt64 n -> pr ", %s" n ) args; + List.iter ( + function + | OFlags n -> pr ", %s" n + ) optargs; pr ");\n" (* Print the trace when we leave a call with debugging enabled. *) and print_trace_leave ret = @@ -3728,13 +3749,14 @@ let generate_lib_api_c () = pr "\n"; List.iter print_wrapper handle_calls -let print_api (name, { args; ret; permitted_states; shortdesc; longdesc; +let print_api (name, { args; optargs; ret; permitted_states; + shortdesc; longde...
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.