Displaying 18 results from an estimated 18 matches for "all_enums".
2019 Aug 10
0
[PATCH libnbd 8/9] generator: Enhance Flags/OFlags with optional "all flags" mask.
...8,6 +898,7 @@ and enum = {
}
and flags = {
flag_prefix : string; (* prefix of each flag name *)
+ all_flags_bitmask : bool; (* if true, generate a bitmask of all flags *)
flags : (string * int) list (* flag names and their values in C *)
}
and permitted_state =
@@ -930,6 +931,7 @@ let all_enums = [ tls_enum ]
(* Flags. *)
let cmd_flags = {
flag_prefix = "CMD_FLAG";
+ all_flags_bitmask = false;
flags = [
"FUA", 1 lsl 0;
"NO_HOLE", 1 lsl 1;
@@ -3547,13 +3549,18 @@ let generate_include_libnbd_h () =
pr "\n"
) all_enums;...
2019 Aug 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
...This call does not block, because it returns data that is saved in
the handle from the NBD protocol handshake."
+(* Enums. *)
+let tls_enum = {
+ enum_prefix = "TLS";
+ enums = [
+ "DISABLE", 0;
+ "ALLOW", 1;
+ "REQUIRE", 2;
+ ]
+}
+let all_enums = [ tls_enum ]
+
(* Flags. *)
let cmd_flags = {
flag_prefix = "CMD_FLAG";
@@ -1020,7 +1036,7 @@ Get the export name associated with the handle.";
"set_tls", {
default_call with
- args = [Int "tls"]; ret = RErr;
+ args = [Enum ("tls",...
2019 Aug 10
17
[PATCH libnbd 0/9] Add Enum and Flags types.
This largish series adds several new features to the generator.
Enum maps to enumerated types (like enum in C). The only current use
for this is replacing the nbd_set_tls (nbd, 0/1/2) parameter with
LIBNBD_TLS_DISABLE, LIBNBD_TLS_ALLOW, LIBNBD_TLS_REQUIRE (and natural
equivalents in other programming languages).
Flags maps to any uint32_t bitmask. It is basically a non-optional,
generalized
2020 Sep 11
0
[libnbd PATCH v2 1/5] api: Add xxx_MASK constant for each Flags type
..."close"; Link "aio_disconnect"];
example = Some "examples/reads-and-writes.c";
};
diff --git a/generator/C.ml b/generator/C.ml
index c9f0ff4..4d4958d 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -349,11 +349,15 @@ let generate_include_libnbd_h () =
) all_enums;
List.iter (
fun { flag_prefix; flags } ->
+ let mask = ref 0 in
List.iter (
fun (flag, i) ->
let flag = sprintf "LIBNBD_%s_%s" flag_prefix flag in
- pr "#define %-40s %d\n" flag i
+ pr "#define %-40s 0x%02x\n&...
2020 Jul 24
4
[libnbd PATCH 0/3] Expose server block size constraints
Necessary when writing a client that wants to avoid unnecessary EINVAL
errors from sending unaligned requests.
At some point, we may want to add synchronous convenience API wrappers
that do request splitting or read-modify-write to obey server
constraints while still appearing to the library client as accepting
any possible request. But such a wrapper should only be synchronous
and not copied to
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
2019 Aug 23
1
[libnbd PATCH 1/1] api: Add support for FAST_ZERO flag
...#define NBD_ENOSPC 28
#define NBD_EOVERFLOW 75
+#define NBD_ENOTSUP 95
#define NBD_ESHUTDOWN 108
#endif /* NBD_PROTOCOL_H */
diff --git a/generator/generator b/generator/generator
index c509573..9b1f5d8 100755
--- a/generator/generator
+++ b/generator/generator
@@ -958,10 +958,11 @@ let all_enums = [ tls_enum ]
let cmd_flags = {
flag_prefix = "CMD_FLAG";
flags = [
- "FUA", 1 lsl 0;
- "NO_HOLE", 1 lsl 1;
- "DF", 1 lsl 2;
- "REQ_ONE", 1 lsl 3;
+ "FUA", 1 lsl 0;
+ "NO_HOLE", 1 lsl 1;...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...-git a/generator/API.ml b/generator/API.ml
index aa970e6..4cd425b 100644
--- a/generator/API.ml
+++ b/generator/API.ml
@@ -87,6 +87,7 @@ and enum = {
}
and flags = {
flag_prefix : string;
+ guard : string option;
flags : (string * int) list
}
and permitted_state =
@@ -165,6 +166,7 @@ let all_enums = [ tls_enum; block_size_enum ]
(* Flags. See also Constants below. *)
let cmd_flags = {
flag_prefix = "CMD_FLAG";
+ guard = Some "((h->strict & LIBNBD_STRICT_FLAGS) || flags > UINT16_MAX)";
flags = [
"FUA", 1 lsl 0;
"NO_HOLE&quo...
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
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
...nit-zero
/interop/interop-nbdkit
/interop/interop-nbdkit-tls-certs
/interop/interop-nbdkit-tls-certs-allow-enabled
diff --git a/generator/generator b/generator/generator
index dea9bf7..0addc9d 100755
--- a/generator/generator
+++ b/generator/generator
@@ -979,7 +979,7 @@ let tls_enum = {
}
let all_enums = [ tls_enum ]
-(* Flags. *)
+(* Flags. See also Constants below. *)
let cmd_flags = {
flag_prefix = "CMD_FLAG";
flags = [
@@ -1969,7 +1969,8 @@ are free to pass in other contexts."
^ non_blocking_test_call_description;
see_also = [SectionLink "Flag calls";...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...6..4cd425b 100644
> --- a/generator/API.ml
> +++ b/generator/API.ml
> @@ -87,6 +87,7 @@ and enum = {
> }
> and flags = {
> flag_prefix : string;
> + guard : string option;
> flags : (string * int) list
> }
> and permitted_state =
> @@ -165,6 +166,7 @@ let all_enums = [ tls_enum; block_size_enum ]
> (* Flags. See also Constants below. *)
> let cmd_flags = {
> flag_prefix = "CMD_FLAG";
> + guard = Some "((h->strict & LIBNBD_STRICT_FLAGS) || flags > UINT16_MAX)";
> flags = [
> "FUA", 1...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
2019 Aug 13
12
[PATCH 0/6] Implement OClosure.
Patches 1-4 are basically uncontroversial, straightforward refactoring
and IMHO we should just push them. Possibly 1-3 should be squashed
together, but I posted them separately so they are easier to review.
Patches 5 and 6 together implement OClosure. Patch 5 adds the feature
and is simple to understand.
Patch 6 changes the Closure completion callbacks into OClosure, but
because it doesn't
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.
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
I will be following up to this email with four separate threads each
addressed to the appropriate single list, with proposed changes to:
- the NBD protocol
- qemu: both server and client
- libnbd: client
- nbdkit: server
The feature in question adds a new optional NBD_INFO_ packet to the
NBD_OPT_GO portion of handshake, adding up to 16 bits of information
that the server can advertise to the
2019 Aug 23
22
cross-project patches: Add NBD Fast Zero support
This is a cover letter to a series of patches being proposed in tandem
to four different projects:
- nbd: Document a new NBD_CMD_FLAG_FAST_ZERO command flag
- qemu: Implement the flag for both clients and server
- libnbd: Implement the flag for clients
- nbdkit: Implement the flag for servers, including the nbd passthrough
client
If you want to test the patches together, I've pushed a