search for: ruint

Displaying 20 results from an estimated 30 matches for "ruint".

Did you mean: uint
2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...+++++++- generator/OCaml.ml | 4 ++++ generator/Python.ml | 2 ++ 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/generator/API.ml b/generator/API.ml index 962b787..bf6030f 100644 --- a/generator/API.ml +++ b/generator/API.ml @@ -66,6 +66,8 @@ and ret = | RCookie | RString | RUInt +| REnum of enum +| RFlags of flags and closure = { cbname : string; cbargs : cbarg list; @@ -442,7 +444,7 @@ test whether this is the case with L<nbd_supports_tls(3)>."; "get_tls", { default_call with - args = []; ret = RInt; + args = []; ret = REnum (tls...
2020 Sep 06
8
[libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
Natural fallout after my recent testsuite additions that fixed a couple of ocaml bugs in the setters. However, on at least the OCaml code, I'm not sure what we should do if a newer libnbd ever returns a bit that an older NBD.mli was not expecting at the time the OCaml compiler ran (see below). I'm also not sure if there is a more efficient way to avoid outputting Val_FOO() converters for
2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...3a1b5 100755 --- a/generator/generator +++ b/generator/generator @@ -873,6 +873,7 @@ and ret = | RInt (* return a small int, -1 = error *) | RInt64 (* 64 bit int, -1 = error *) | RString (* return a newly allocated string, caller frees *) +| RUInt (* return a bitmask, no error possible *) and permitted_state = | Created (* can be called in the START state *) | Connecting (* can be called when connecting/handshaking *) @@ -2013,7 +2014,7 @@ Do not do anything else with the file descriptor.&...
2020 Sep 07
2
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...PI.mli b/generator/API.mli > index 712e837..e45b5c0 100644 > --- a/generator/API.mli > +++ b/generator/API.mli > @@ -78,6 +78,8 @@ and ret = > | RString (** return a newly allocated string, > caller frees, NULL for error *) > | RUInt (** return a bitmask, no error possible *) > +| REnum of enum (** return an enum, no error possible *) > +| RFlags of flags (** return bitmask of flags, no error possible *) > and closure = { > cbname : string; (** name of callback func...
2020 Sep 07
1
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...> > >>+++ b/generator/C.ml > >>@@ -66,15 +66,15 @@ let errcode_of_ret = > >> function > >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" > >> | RStaticString | RString -> Some "NULL" > >>- | RUInt -> None (* errors not possible *) > >>+ | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) > >> > >> let type_of_ret = > >> function > >>- | RBool | RErr | RFd | RInt -> "int" > >>+ | RBool | RErr | RFd...
2020 Sep 07
0
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...AM, Richard W.M. Jones wrote: >> +++ b/generator/C.ml >> @@ -66,15 +66,15 @@ let errcode_of_ret = >> function >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" >> | RStaticString | RString -> Some "NULL" >> - | RUInt -> None (* errors not possible *) >> + | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) >> >> let type_of_ret = >> function >> - | RBool | RErr | RFd | RInt -> "int" >> + | RBool | RErr | RFd | RInt | REnum (_) ->...
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.
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...e } -> String.capitalize_ascii cbname + | OFlags (n, _) -> String.capitalize_ascii n + +(* For consistency every method will return (type, error) where + * type is defined by this function. However some functions + * never really have a type (RErr) and others never really have + * an error (RUInt). + *) +let go_ret_type = function + | RBool -> "bool" + | RStaticString -> "*string" + | RErr -> "int" (* always 0 *) + | RFd -> "int/*XXX*/" + | RInt -> "int" + | RInt64 -> "int64" + | RCookie -> "int64&q...
2020 Sep 06
0
[libnbd PATCH 2/3] golang: Typesafe returns for REnum/RFlags
...go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generator/GoLang.ml b/generator/GoLang.ml index 732b81f..aecd2d5 100644 --- a/generator/GoLang.ml +++ b/generator/GoLang.ml @@ -99,8 +99,8 @@ let go_ret_type = function * always nil unless h is closed *) | RUInt -> Some "uint" - | REnum (_) -> Some "uint" (* XXX return typed constant instead? *) - | RFlags (_) -> Some "uint" (* XXX return typed constant instead? *) + | REnum ({ enum_prefix}) -> Some (camel_case enum_prefix) + | RFlags ({ flag_prefix}) -> Som...
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...0 insertions(+), 8 deletions(-) diff --git a/generator/OCaml.ml b/generator/OCaml.ml index 4a835b0..cb6633c 100644 --- a/generator/OCaml.ml +++ b/generator/OCaml.ml @@ -66,8 +66,8 @@ and ocaml_ret_to_string = function | RCookie -> "cookie" | RString -> "string" | RUInt -> "int" - | REnum (_) -> "int" (* XXX return enum_prefix.t instead *) - | RFlags (_) -> "int" (* XXX return flag_prefix.t list instead *) + | REnum ({ enum_prefix }) -> enum_prefix ^ ".t" + | RFlags ({ flag_prefix }) -> flag_prefix ^ &quot...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...insertions(+), 12 deletions(-) diff --git a/generator/OCaml.ml b/generator/OCaml.ml index db7003c..4bcd450 100644 --- a/generator/OCaml.ml +++ b/generator/OCaml.ml @@ -66,8 +66,8 @@ and ocaml_ret_to_string = function | RCookie -> "cookie" | RString -> "string" | RUInt -> "int" - | REnum _ -> "int" (* XXX return enum_prefix.t instead *) - | RFlags _ -> "int" (* XXX return flag_prefix.t list instead *) + | REnum { enum_prefix } -> enum_prefix ^ ".t" + | RFlags { flag_prefix } -> flag_prefix ^ ".t list...
2019 Jul 27
3
[PATCH libnbd] lib: Use symbol versions.
This patch adds support for symbol versions. It is based on what libvirt does. The generated syms file looks like: LIBNBD_1.0 { global: nbd_...; nbd_...; local: *; }; In a future stable 1.2 release, new symbols would go into a new section which would look like this: LIBNBD_1.2 { global: nbd_new_symbol; nbd_another_new_symbol; local: *; } LIBNBD_1.0; In my testing the
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 13
0
[PATCH libnbd 5/6] generator: Implement OClosure.
...s = List.map ( function + | OClosure { cbname } -> cbname, Some "None", None | OFlags (n, _) -> n, Some "0", None ) optargs in let args = args @ optargs in @@ -4756,6 +4774,8 @@ and ocaml_ret_to_string = function | RUInt -> "int" and ocaml_optarg_to_string = function + | OClosure { cbname; cbargs } -> + sprintf "?%s:(%s)" cbname (ocaml_closuredecl_to_string cbargs) | OFlags (n, { flag_prefix }) -> sprintf "?%s:%s.t list" n flag_prefix and ocaml_closuredecl_to_str...
2019 Aug 13
1
Re: [PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
On 8/13/19 10:12 AM, Richard W.M. Jones wrote: > Commit 0904dd113dfa36485623b3c1756dc1aeab3dddeb removed the > theoretical possibility of clearing the debug callback from the handle > by setting it to NULL (although that was dubious from an API point of > view). > > This commit adds an explicit way to do this. Another advantage of > this is we can internally call this API
2019 Aug 13
0
[PATCH libnbd v2 1/3] generator: Implement OClosure.
...s = List.map ( function + | OClosure { cbname } -> cbname, Some "None", None | OFlags (n, _) -> n, Some "0", None ) optargs in let args = args @ optargs in @@ -4767,6 +4786,8 @@ and ocaml_ret_to_string = function | RUInt -> "int" and ocaml_optarg_to_string = function + | OClosure { cbname; cbargs } -> + sprintf "?%s:(%s)" cbname (ocaml_closuredecl_to_string cbargs) | OFlags (n, { flag_prefix }) -> sprintf "?%s:%s.t list" n flag_prefix and ocaml_closuredecl_to_str...
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...t = | RBool (* return a boolean, or error *) | RStaticString (* return a static string (must be located in @@ -881,6 +875,19 @@ and ret = | RString (* return a newly allocated string, caller frees, NULL for error *) | RUInt (* return a bitmask, no error possible *) +and closure = { + cbname : string; (* name of callback function *) + cbargs : cbarg list; (* all closures return int for now *) +} +and cbarg = +| CBArrayAndLen of arg * string (* array + number of entries *) +| CBBytesIn o...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...+=back + +Future NBD extensions may add further flags. +"; + see_also = ["L<nbd_get_handshake_flags(3)>"; + "L<nbd_set_request_structured_replies(3)>"]; + }; + + "get_handshake_flags", { + default_call with + args = []; ret = RUInt; + may_set_error = false; + shortdesc = "see which handshake flags are supported"; + longdesc = "\ +Return the state of the handshake flags on this handle. When the +handle has not yet completed a connection (see C<nbd_aio_is_created>), +this returns the flags that th...
2020 Sep 07
4
[libnbd PATCH v2 0/3] Improve type-safety of ocaml/golang getters
Well, the golang changes (patch 1 and 2/3 of v1) were already committed, all that was left was the OCaml changes. I'm a lot happier with how things turned out with an UNKNOWN constructor in the OCaml variants. Eric Blake (3): tests: Enhance coverage of enum/flag range checking ocaml: Support unknown values for Enum/Flags ocaml: Typesafe returns for REnum/RFlags generator/OCaml.ml
2020 Mar 24
1
[PATCH libnbd v3] Add Go language bindings (golang) (RHBZ#1814538).
This feature is roughly finished now, although it needs a few more tests and some examples. It's pretty much up to par with all the other bindings, but it lacks a completely safe AIO buffer. It won't stop you from freeing the buffer too early) because golang's GC inexplicably lacks a way to declare a root from C. I can probably do it with a global variable and ref counting on the