search for: print_call

Displaying 15 results from an estimated 15 matches for "print_call".

2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...> if types then pr "nbd_%s_callback " cbname; - pr "%s_callback" cbname + pr "%s%s_callback" closure_mark cbname | OFlags (n, _) -> if types then pr "uint32_t "; pr "%s" n ) optargs -let print_call ?wrap ?maxcol name args optargs ret = +let print_call ?wrap ?maxcol ?closure_mark name args optargs ret = pr "%s nbd_%s " (type_of_ret ret) name; - print_arg_list ~handle:true ?wrap ?maxcol args optargs + print_arg_list ~handle:true ?wrap ?maxcol ?closure_mark args optargs -let prin...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
.... generator/generator | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/generator/generator b/generator/generator index db7c10f..7d0ea3f 100755 --- a/generator/generator +++ b/generator/generator @@ -2712,6 +2712,12 @@ let print_extern name args ret = print_call name args ret; pr ";\n" +let print_extern_and_define name args ret = + let name_upper = String.uppercase_ascii name in + print_extern name args ret; + pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper; + pr "\n" + let generate_include_libnbd_h () = generate_he...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...r "%s" n ) args; + List.iter ( + fun optarg -> + if !comma then pr ", "; + comma := true; + match optarg with + | OFlags n -> + if types then pr "uint32_t "; + pr "%s" n + ) optargs; pr ")" -let print_call name args ret = +let print_call name args optargs ret = pr "%s nbd_%s " (type_of_ret ret) name; - print_arg_list ~handle:true args + print_arg_list ~handle:true args optargs -let print_extern name args ret = +let print_extern name args optargs ret = pr "extern "; - pr...
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.
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 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...ror is false, permitted_states must be empty (any permitted state)" name + | name, { ret = RUInt; may_set_error = true } -> + failwithf "%s: if ret is RUInt, may_set_error must be false" name | _ -> () ) handle_calls @@ -3189,6 +3192,7 @@ let print_call name args ret = | RConstString -> pr "const char *" | RInt64 -> pr "int64_t " | RString -> pr "char *" + | RUInt -> pr "unsigned " ); pr "nbd_%s " name; print_arg_list ~handle:true args @@ -3329,10 +3333,11 @@ let...
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 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...t; cbname; + if types then pr "nbd_%s_callback " cbname; + pr "%s_callback" cbname; pr ", "; if types then pr "void *"; pr "%s_user_data" cbname @@ -3297,6 +3337,24 @@ let print_extern name args ret = print_call name args ret; pr ";\n" +(* Callback typedefs in <libnbd.h> *) +let print_closure_typedefs () = + let all_cls = + List.map ( + fun (_, { args }) -> + filter_map (function Closure cl -> Some cl | _ -> None) args + ) handle_calls in + let all_cls = Li...
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...- | Mutable (Int n) -> - if types then pr "int *"; - pr "%s" n - | Mutable arg -> assert false | Path n | String n -> if types then pr "const char *"; @@ -3398,6 +3379,53 @@ let print_extern name args ret = print_call name args ret; pr ";\n" +let print_cbarg_list ?(valid_flag = true) ?(types = true) cbargs = + pr "("; + if valid_flag then ( + if types then pr "unsigned "; + pr "valid_flag"; + pr ", "; + ); + if types then pr "void *";...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...t : ?valid_flag:bool -> ?types:bool -> cbarg list -> unit + val print_cbarg_list : ?types:bool -> cbarg list -> unit val errcode_of_ret : ret -> string option val type_of_ret : ret -> string end = struct @@ -3430,13 +3430,8 @@ let print_extern name args optargs ret = print_call name args optargs ret; pr ";\n" -let print_cbarg_list ?(valid_flag = true) ?(types = true) cbargs = +let print_cbarg_list ?(types = true) cbargs = pr "("; - if valid_flag then ( - if types then pr "unsigned "; - pr "valid_flag"; - pr ",...
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of breaking OCaml bindings), but I'm open to ideas on how to improve it. Eric Blake (2): generator: Tweak print_c_arg_list to take alternate first arg RFC: generator: Handle shared callbacks in Python generator/generator | 556 ++++++++++++++++++++++---------------------- 1 file changed, 280 insertions(+), 276 deletions(-) --
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...t : ?valid_flag:bool -> ?types:bool -> cbarg list -> unit + val print_cbarg_list : ?types:bool -> cbarg list -> unit val errcode_of_ret : ret -> string option val type_of_ret : ret -> string end = struct @@ -3284,13 +3284,8 @@ let print_extern name args optargs ret = print_call name args optargs ret; pr ";\n" -let print_cbarg_list ?(valid_flag = true) ?(types = true) cbargs = +let print_cbarg_list ?(types = true) cbargs = pr "("; - if valid_flag then ( - if types then pr "unsigned "; - pr "valid_flag"; - pr ",...
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 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is