Displaying 12 results from an estimated 12 matches for "renum".
Did you mean:
enum
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_enum);...
2020 Sep 06
8
[libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
...he 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 types not
referenced in REnum/RFlags than my hack of __attribute__((unused)).
Hence I'll wait for a review on these.
Now, for the future compatibility lesson, promised above.
nbd_get_handshake_flags is documented as potentially returning
additional bits from a newer libnbd than what the current client code
was compiled aga...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...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"
and ocaml_optarg_to_stri...
2020 Sep 07
2
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...erator/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 function *)
> cbargs : cbarg list; (** all closures return int for now...
2020 Sep 06
0
[libnbd PATCH 2/3] golang: Typesafe returns for REnum/RFlags
...nsertions(+), 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}) -> Some (camel_case flag_prefix)
let go_ret...
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...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 ^ ".t list"
and ocaml_optarg...
2020 Sep 07
0
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...> @@ -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 (_) -> "int"
>
> This is good because Enum is passed as...
2020 Sep 07
1
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...5 @@ 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 (_) -> "int"
> >
> >This is g...
2020 Sep 07
4
[libnbd PATCH v2 0/3] Improve type-safety of ocaml/golang getters
...ommitted, 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 | 123 +++++++++++++++---
python/t/120-set-non-defaults.py | 12 ++
ocaml/tests/test_110_defaults.ml | 5 +-
ocaml/tests/test_120_set_non_defaults.ml | 19 ++-
tests/errors.c |...
2020 Sep 07
0
Re: [libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
...;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 types not
> referenced in REnum/RFlags than my hack of __attribute__((unused)).
> Hence I'll wait for a review on these.
>
> Now, for the future compatibility lesson, promised above.
> nbd_get_handshake_flags is documented as potentially returning
> additional bits from a newer libnbd than what the current cli...
2020 Sep 11
0
[libnbd PATCH v2 3/5] api: Add nbd_set_strict_mode
..._call = { args = []; optargs = []; ret = RErr;
shortdesc = ""; longdesc = ""; example = None;
@@ -451,7 +464,7 @@ test whether this is the case with L<nbd_supports_tls(3)>.";
"get_tls", {
default_call with
- args = []; ret = REnum (tls_enum);
+ args = []; ret = REnum tls_enum;
may_set_error = false;
shortdesc = "get the TLS request setting";
longdesc = "\
@@ -610,7 +623,7 @@ for integration testing, it can be useful to clear this flag
rather than find a way to alter the server to fail the ne...
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