search for: rstaticstring

Displaying 20 results from an estimated 25 matches for "rstaticstring".

2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...list; (** all closures return int for now *) diff --git a/generator/C.ml b/generator/C.ml index 6b65f6e..1eb5e85 100644 --- a/generator/C.ml +++ 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 (_) -> "...
2020 Sep 07
2
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...r now *) > diff --git a/generator/C.ml b/generator/C.ml > index 6b65f6e..1eb5e85 100644 > --- a/generator/C.ml > +++ 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 |...
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...ize_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" + | RString -> "*string" + | RUInt -> "uint" + +let go_...
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 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
2020 Sep 07
0
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
On 9/7/20 9:13 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"...
2019 Sep 17
1
Re: [PATCH libnbd 2/2] api: New API for reading NBD protocol.
...iation > (%NEWSTYLE.FINISHED) so we can route all successful option > negotiations through a single path before moving to the %READY state, > allowing us to set h->protocol in one place. > --- > + "get_protocol", { > + default_call with > + args = []; ret = RStaticString; > + permitted_states = [ Connected; Closed ]; > + shortdesc = "return the NBD protocol variant"; > + longdesc = "\ > +Return the NBD protocol variant in use on the connection. At > +the moment this returns one of the strings C<\"oldstyle\">,...
2020 Sep 07
1
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...0, Eric Blake wrote: > On 9/7/20 9:13 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 | RI...
2019 Sep 17
3
[PATCH libnbd 1/2] api: Add new API to read whether TLS was negotiated.
When LIBNBD_TLS_ALLOW is used we don't have a way to find out if TLS was really negotiated. This adds a flag and a way to read it back. Unfortunately there is no test yet, because LIBNBD_TLS_ALLOW is not tested -- it really should be but requires quite a complicated set of tests because ideally we'd like to find out whether it falls back correctly for all supported servers. --- TODO
2020 Sep 11
0
[libnbd PATCH v2 2/5] generator: Refactor filtering of accepted OFlags
...a/generator/API.ml b/generator/API.ml index 42eeac0..b212e95 100644 --- a/generator/API.ml +++ b/generator/API.ml @@ -55,7 +55,7 @@ and arg = | UInt64 of string and optarg = | OClosure of closure -| OFlags of string * flags +| OFlags of string * flags * string list option and ret = | RBool | RStaticString @@ -1485,7 +1485,11 @@ Future NBD extensions may result in additional C<size_type> values. "pread", { default_call with args = [ BytesOut ("buf", "count"); UInt64 "offset" ]; - optargs = [ OFlags ("flags", cmd_flags) ]; + (*...
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...l_int (r);\n" (* XXX Use Val_flag_prefix() *) + | REnum ({ enum_prefix }) -> pr " rv = Val_%s (r);\n" enum_prefix + | RFlags ({ flag_prefix }) -> pr " rv = Val_%s (r);\n" flag_prefix | RInt64 | RCookie -> pr " rv = caml_copy_int64 (r);\n" | RStaticString -> pr " rv = caml_copy_string (r);\n" | RString -> diff --git a/ocaml/tests/test_110_defaults.ml b/ocaml/tests/test_110_defaults.ml index 6953b2d..f969b2f 100644 --- a/ocaml/tests/test_110_defaults.ml +++ b/ocaml/tests/test_110_defaults.ml @@ -24,11 +24,12 @@ let () = let in...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...= Val_int (r);\n" (* XXX Use Val_flag_prefix() *) + | REnum { enum_prefix } -> pr " rv = Val_%s (r);\n" enum_prefix + | RFlags { flag_prefix } -> pr " rv = Val_%s (r);\n" flag_prefix | RInt64 | RCookie -> pr " rv = caml_copy_int64 (r);\n" | RStaticString -> pr " rv = caml_copy_string (r);\n" | RString -> diff --git a/ocaml/tests/test_110_defaults.ml b/ocaml/tests/test_110_defaults.ml index 6953b2d..54f2cbc 100644 --- a/ocaml/tests/test_110_defaults.ml +++ b/ocaml/tests/test_110_defaults.ml @@ -24,11 +24,12 @@ let () = let in...
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 Sep 17
0
[PATCH libnbd 2/2] api: New API for reading NBD protocol.
...* Fixed newstyle NBD_OPT_STARTTLS option. *) @@ -1574,6 +1584,20 @@ are free to pass in other contexts." "L<nbd_block_status(3)>"; "L<nbd_aio_block_status(3)>"]; }; + "get_protocol", { + default_call with + args = []; ret = RStaticString; + permitted_states = [ Connected; Closed ]; + shortdesc = "return the NBD protocol variant"; + longdesc = "\ +Return the NBD protocol variant in use on the connection. At +the moment this returns one of the strings C<\"oldstyle\">, +C<\"newstyle\&qu...
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
2020 Mar 25
3
[PATCH libnbd v4] Add Go language bindings (golang) (RHBZ#1814538).
Now runs a complete set of tests, notably including the AIO test. File descriptors are passed in and out as plain ints (instead of *os.File) for a couple of reasons: (1) We have to pass the plain int to syscall.Select. (2) Turning an fd into an os.File causes golang to set the blocking flag which is deeply unhelpful. Rich.
2019 Aug 10
0
[PATCH libnbd 2/9] generator: Generalize OFlags.
...ing (* 32 bit unsigned int *) | UInt64 of string (* 64 bit unsigned int *) and optarg = -| OFlags of string (* NBD_CMD_FLAG_* flags *) +| OFlags of string * flags (* optional flags, uint32_t in C *) and ret = | RBool (* return a boolean, or error *) | RStaticString (* return a static string (must be located in @@ -890,6 +890,10 @@ and cbarg = | CBString of string (* like String *) | CBUInt of string (* like UInt *) | CBUInt64 of string (* like UInt64 *) +and flags = { + flag_prefix : string; (* prefix of each flag name *)...
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 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...* 32 bit unsigned int *) | UInt64 of string (* 64 bit unsigned int *) -and closure = { - cbname : string; (* name of callback function *) - cbargs : arg list; (* all closures return int for now *) -} and ret = | 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 =...