search for: print_extern

Displaying 17 results from an estimated 17 matches for "print_extern".

2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...gh I like the resulting libnbd.h. 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_includ...
2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...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 print_extern ?wrap name args optargs ret = +let print_extern ?wrap ?closure_mark name args optargs ret = pr "extern "; - print_call ?wrap name args optargs ret; + print_call ?wrap ?closure_mark name args optargs ret; pr ";\n" let rec print_cbarg_list ?(wrap = false) ?maxcol ?types...
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...%s%c_callback" (match closure_mark with AddressOf -> '&' | Dereference -> '*') cbname ... > @@ -385,7 +386,7 @@ let generate_lib_unlocked_h () = > pr "\n"; > List.iter ( > fun (name, { args; optargs; ret }) -> > - print_extern ~wrap:true ("unlocked_" ^ name) args optargs ret > + print_extern ~wrap:true ~closure_mark:"*" ("unlocked_" ^ name) args optargs ret And at call sites like this one you'd use ~closure_mark:Dereference Rest is fine. ACK but definitely remove the superfluo...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...quot;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 "; - print_call name args ret; + print_call name args optargs ret; pr ";\n" let print_cbarg_list ?(valid_flag = true) ?(types = true) cbargs = @@ -3444,9 +3458,9 @@ let print_closure_typedefs () =...
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
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 31
1
[PATCH libnbd] Add bindings for Rust language
Still not working, but I took the latest patch and: - rebased it against libnbd 1.0 - fixed it so it handles new args and cbargs The generator now runs without warnings. This patch doesn't handle optargs at all. In C these are converted to non-optional parameter. Rust doesn't (AFAIK) have optional or labelled arguments unfortunately. Rich.
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...else - pr "%s" 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 + ) handl...
2019 Jul 07
2
[libnbd PATCH] RFC: Add bindings for Rust language
...t; len + | UInt n -> pri (); pr "%s: c_uint,\n" n + | UInt32 n -> pri (); pr "%s: u32,\n" n + | UInt64 n -> pri (); pr "%s: u64,\n" n + ); + ) args; + pr_indent (indent - 1); pr ")" + +let generate_rust_sys_lib_rs () = + let print_extern (name, {args; ret; _ }) = + let ret_rs_type = + match ret with + | RBool + | RErr + | RFd + | RInt -> "c_int" + | RConstString -> "*const c_char" + | RInt64 -> "i64" + | RString -> "*mut c_char" + in +...
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 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...;; pr "%s" n - | 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 type...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...g list -> unit - val print_cbarg_list : ?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 &...
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.
...g list -> unit - val print_cbarg_list : ?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 &...
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