search for: print_arg_list

Displaying 20 results from an estimated 41 matches for "print_arg_list".

2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...+++++++++++++++++++++------------------------- 5 files changed, 73 insertions(+), 71 deletions(-) diff --git a/generator/C.ml b/generator/C.ml index deb77fa..280b319 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -99,16 +99,17 @@ let rec name_of_arg = function | UInt64 n -> [n] let rec print_arg_list ?(wrap = false) ?maxcol ?handle ?types ?(parens = true) + ?(closure_mark) args optargs = + if parens then pr "("; + if wrap then + pr_wrap ?maxcol ',' + (fun () -> print_arg_list' ?handle ?types ?closure_mark args optargs) + else + print_arg_list'...
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...; 5 files changed, 73 insertions(+), 71 deletions(-) > > diff --git a/generator/C.ml b/generator/C.ml > index deb77fa..280b319 100644 > --- a/generator/C.ml > +++ b/generator/C.ml > @@ -99,16 +99,17 @@ let rec name_of_arg = function > | UInt64 n -> [n] > > let rec print_arg_list ?(wrap = false) ?maxcol ?handle ?types ?(parens = true) > + ?(closure_mark) args optargs = You don't need parens around here, you can just write ?closure_mark > + if parens then pr "("; > + if wrap then > + pr_wrap ?maxcol ',' > + (fun () -&...
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...exist during the function call *) > +| Closure of closure (* function pointer + void *opaque *) Re-echoing my comment in 1/3, writing this as 'Closure of string * arg list' may seem cleaner (certainly less typing below). > @@ -3196,6 +3180,12 @@ let rec print_arg_list ?(handle = false) ?(user_data = false) > if types then pr "struct nbd_handle *"; > pr "h" > ); > + if valid_flag then ( > + if !comma then pr ", "; > + comma := true; > + if types then pr "int "; > + pr "...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...nbd_aio_FOO_callback callback is always > called exactly once with VALID|FREE, so your bug here is masked because > of that calling convention - but we should really fix this one to be a > better example). Ah, I see. I can fix this in the commit. > > @@ -3196,6 +3180,12 @@ let rec print_arg_list ?(handle = false) ?(user_data = false) > > if types then pr "struct nbd_handle *"; > > pr "h" > > ); > > + if valid_flag then ( > > + if !comma then pr ", "; > > + comma := true; > > + if types then pr &q...
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 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...quot;)]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3121,7 +3103,8 @@ module C : sig val generate_lib_unlocked_h : unit -> unit val generate_lib_api_c : unit -> unit val generate_docs_libnbd_api_pod : unit -> unit - val print_arg_list : ?handle:bool -> ?user_data:bool -> ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?valid_flag:bool -> ?user_data:bool -> + ?types:bool -> arg list -> unit end = struct (* Check the API definition. *) @@ -3174,7 +3157,7...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...ed ]; shortdesc = "send block status command to the NBD server, with callback on completion"; @@ -3149,7 +3160,8 @@ module C : sig val generate_lib_unlocked_h : unit -> unit val generate_lib_api_c : unit -> unit val generate_docs_libnbd_api_pod : unit -> unit - val print_arg_list : ?handle:bool -> ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?types:bool -> + arg list -> optarg list -> unit val print_cbarg_list : ?valid_flag:bool -> ?types:bool -> cbarg list -> unit val errcode_of_ret : ret...
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.
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...uot;)] }; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3142,8 +3149,8 @@ module C : sig val generate_lib_unlocked_h : unit -> unit val generate_lib_api_c : unit -> unit val generate_docs_libnbd_api_pod : unit -> unit - val print_arg_list : ?handle:bool -> ?valid_flag:bool -> ?user_data:bool -> - ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?types:bool -> arg list -> unit + val print_cbarg_list : ?valid_flag:bool -> ?types:bool -> cbarg list -> unit...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...quot;)]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3121,7 +3103,8 @@ module C : sig val generate_lib_unlocked_h : unit -> unit val generate_lib_api_c : unit -> unit val generate_docs_libnbd_api_pod : unit -> unit - val print_arg_list : ?handle:bool -> ?user_data:bool -> ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?valid_flag:bool -> ?user_data:bool -> + ?types:bool -> arg list -> unit end = struct (* Check the API definition. *) @@ -3174,7 +3157,7...
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 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...quot;)]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3037,7 +3019,8 @@ module C : sig val generate_lib_unlocked_h : unit -> unit val generate_lib_api_c : unit -> unit val generate_docs_libnbd_api_pod : unit -> unit - val print_arg_list : ?handle:bool -> ?user_data:bool -> ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?valid_flag:bool -> ?user_data:bool -> + ?types:bool -> arg list -> unit end = struct (* Check the API definition. *) @@ -3090,7 +3073,7...
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
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 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...> [n; len] -| Closure (_, closures) -> - List.map (fun { cbname } -> cbname) closures @ ["user_data"] +| Closure (_, { cbname }) -> [cbname; sprintf "%s_user_data" cbname ] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] @@ -3241,19 +3228,16 @@ let rec print_arg_list ?(handle = false) ?(user_data = false) pr "%s, " n; if types then pr "size_t "; pr "%s" len - | Closure (_, cls) -> - List.iter ( - fun { cbname; cbargs } -> - if types then ( - pr &qu...
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.
2023 May 02
1
[libnbd PATCH v2 2/2] generator/C: lib/api.c: indent arg list 2 spaces relative to function name
...iff --git a/generator/C.ml b/generator/C.ml index e68fd70382cf..f772117cd3c9 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -566,7 +566,8 @@ let let ret_c_type = type_of_ret ret and errcode = errcode_of_ret ret in pr "%s\n" ret_c_type; pr "nbd_%s " name; - print_arg_list ~wrap:true ~handle:true args optargs; + print_arg_list ~wrap:true ~handle:true ~parens:(ParensNewLineWithIndent 0) + args optargs; pr "\n"; pr "{\n"; if permitted_states <> [] then
2020 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...rator/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 " out:\n"; + if may_set_error...
2020 Mar 17
5
[PATCH libnbd v2 0/3] Unfinished golang bindings.
These bindings get as far as running very simple connections. However there are many missing parts still: * No callbacks. * No functions which handle buffers (pread/pwrite!) This is posted just for general early interest, not even for review. Rich.
2019 Jul 25
4
Re: [PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...28 +3707,16 @@ let print_python_binding name { args; ret } = > + | Closure { cbname; cbargs } -> > pr "/* Wrapper for %s callback of %s. */\n" cbname name; > pr "static int\n"; > pr "%s_%s_wrapper " name cbname; > - C.print_arg_list ~user_data:true cbargs; > + C.print_arg_list ~valid_flag:true ~user_data:true cbargs; > pr "\n"; > pr "{\n"; > - pr " int ret;\n"; > + pr " int ret = 0;\n"; > + pr "\n"; > + pr &qu...