Displaying 20 results from an estimated 44 matches for "libnbd_".
Did you mean:
libnbd
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...fix ^ ".t"
+ | RFlags ({ flag_prefix }) -> flag_prefix ^ ".t list"
and ocaml_optarg_to_string = function
| OClosure { cbname; cbargs } ->
@@ -332,10 +332,33 @@ let print_ocaml_enum_val { enum_prefix; enums } =
fun i (enum, _) ->
pr " case %d: r = LIBNBD_%s_%s; break;\n" i enum_prefix enum
) enums;
+ pr " default: abort ();\n";
pr " }\n";
pr "\n";
pr " return r;\n";
pr "}\n";
+ pr "\n";
+ pr "/* Convert int to OCaml %s.t. */\n" enum_prefix;
+ (* Easier t...
2020 Sep 07
4
[libnbd PATCH v2 0/3] Improve type-safety of ocaml/golang getters
...rator/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 | 32 +++++
.../libnbd_120_set_non_defaults_test.go | 28 +++-
6 files changed, 194 insertions(+), 25 deletions(-)
--
2.28.0
2019 Aug 10
0
[PATCH libnbd 8/9] generator: Enhance Flags/OFlags with optional "all flags" mask.
...nd 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;
List.iter (
- fun { flag_prefix; flags } ->
+ fun { flag_prefix; all_flags_bitmask; flags } ->
List.iter (
fun (flag, i) ->
let flag = sprintf "LIBNBD_%s_%s" flag_prefix flag in
pr "...
2020 Sep 06
8
[libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
...l 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 against. How? Let's say a future NBD protocol addition
adds LIBNBD_HANDSHAKE_FLAG_64BIT (as that one might actually be a way
that we implement 64-bit requests...). Presumably, once the NBD
protocol defines it and future libnbd implements it, then future
libnbd will default to setting that bit during nbd_create(). An older
C client that did:
flags = nbd_get_hands...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...enerator/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_include_libnbd_h () =
generate_header CStyle;
@@ -2729,14 +2735,23 @@ let generate_include_libnbd_h () =
List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants;
pr "\n";
pr &quo...
2020 Sep 11
0
[libnbd PATCH v2 1/5] api: Add xxx_MASK constant for each Flags type
...| 3 +--
python/t/120-set-non-defaults.py | 5 ++---
ocaml/tests/test_110_defaults.ml | 3 +--
ocaml/tests/test_120_set_non_defaults.ml | 3 +--
tests/errors.c | 9 +++------
.../libnbd/libnbd_110_defaults_test.go | 2 +-
.../libnbd/libnbd_120_set_non_defaults_test.go | 4 ++--
14 files changed, 58 insertions(+), 31 deletions(-)
diff --git a/docs/libnbd.pod b/docs/libnbd.pod
index f2ba3bb..d8dffea 100644
--- a/docs/libnbd.pod
+++ b/docs/libnbd.pod
@@ -520,6 +520,13 @@...
2019 Aug 11
3
[PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
...883d245fc56.
---
generator/generator | 46 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/generator/generator b/generator/generator
index 55c4dfc..0ea6b61 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3284,6 +3284,7 @@ let generate_lib_libnbd_syms () =
pr "LIBNBD_%d.%d {\n" major minor;
pr " global:\n";
if (major, minor) = (1, 0) then (
+ pr " nbd_add_free_callback;\n";
pr " nbd_create;\n";
pr " nbd_close;\n";
pr " n...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...n";
+ pr "Val_%s (int i)\n" enum_prefix;
+ pr "{\n";
+ pr " CAMLparam0 ();\n";
+ pr " CAMLlocal1 (rv);\n";
+ pr "\n";
+ pr " switch (i) {\n";
+ List.iteri (
+ fun i (enum, _) ->
+ pr " case LIBNBD_%s_%s: rv = Val_int (%d); break;\n" enum_prefix enum i
+ ) enums;
+ pr " default:\n";
+ pr " rv = caml_alloc (1, 0); /* UNKNOWN of int */\n";
+ pr " Store_field (rv, 0, Val_int (i));\n";
+ pr " }\n";
+ pr "\n";
+ p...
2019 Aug 10
0
[PATCH libnbd 2/9] generator: Generalize OFlags.
...true) args optargs =
if !comma then pr ", ";
comma := true;
match optarg with
- | OFlags n ->
+ | OFlags (n, _) ->
if types then pr "uint32_t ";
pr "%s" n
) optargs;
@@ -3501,7 +3512,20 @@ let generate_include_libnbd_h () =
pr "\n";
pr "struct nbd_handle;\n";
pr "\n";
- List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants;
+ List.iter (
+ fun { flag_prefix; flags } ->
+ List.iter (
+ fun (flag, i) ->
+ let flag...
2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...aller must free the\n";
pr "returned string to avoid a memory leak.\n";
| RUInt ->
- pr "This call returns a bitmask.\n"
+ pr "This call returns a bitmask.\n";
+ | REnum ({ enum_prefix }) ->
+ pr "This call returns one of the LIBNBD_%s_* values.\n" enum_prefix;
+ | RFlags ({ flag_prefix }) ->
+ pr "This call returns a bitmask of LIBNBD_%s_* values.\n" flag_prefix;
);
pr "\n";
diff --git a/generator/GoLang.ml b/generator/GoLang.ml
index 65b3690..732b81f 100644
--- a/generator/GoLang.ml
+...
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 ‘local:’ label is needed....
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...s" n
| Opaque n -> pr "void *%s" n
+ | ReadStatus n -> pr "enum nbd_read_status %s" n
| Path n
| String n -> pr "const char *%s" n
| StringList n -> pr "char **%s" n
@@ -2896,6 +2902,13 @@ let generate_include_libnbd_h () =
pr "\n";
List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants;
pr "\n";
+ List.iter (
+ fun (name, list) ->
+ pr "enum %s {\n" name;
+ List.iter (fun (n, i) -> pr " LIBNBD_%-30s = %d,\n" n i)...
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 variation on OFlags with some nice features.
Two commits also add checking so that we check that the Enum, Fl...
2019 Aug 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
Previously nbd_set_tls had an integer argument which was 0 for
disable, 1 for allow and 2 for require. This commit adds a proper
enumerated type to describe this, defining LIBNBD_TLS_DISABLE = 0,
LIBNBD_TLS_ALLOW = 1 and LIBNBD_TLS_REQUIRE = 2. (Note the C API
doesn't change).
In C the enumerated type is still defined and passed as an int (not as
an enum). While we could define an enum type for this, there are ABI
stability problems inherent in enums in C.
In OCaml t...
2019 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...n -> pr "void *%s" n
> + | ReadStatus n -> pr "enum nbd_read_status %s" n
> | Path n
> | String n -> pr "const char *%s" n
> | StringList n -> pr "char **%s" n
> @@ -2896,6 +2902,13 @@ let generate_include_libnbd_h () =
> pr "\n";
> List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants;
> pr "\n";
> + List.iter (
> + fun (name, list) ->
> + pr "enum %s {\n" name;
> + List.iter (fun (n, i) -> pr "...
2019 Aug 10
0
[PATCH libnbd 5/9] generator: On entry to API functions, check Enum parameters.
In the generated wrapper code this adds checks for all Enum
parameters. Since only nbd_set_tls uses an Enum parameter, the only
extra code generated by this change is:
int
nbd_set_tls (struct nbd_handle *h, int tls) {
// ...
switch (tls) {
case LIBNBD_TLS_DISABLE:
case LIBNBD_TLS_ALLOW:
case LIBNBD_TLS_REQUIRE:
break;
default:
set_error (EINVAL, "%s: invalid value for parameter: %d",
"tls", tls);
ret = -1;
goto out;
}
This doesn't change the C API, but previously th...
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 filter...
2019 Aug 12
0
Re: [PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
...or | 46 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/generator/generator b/generator/generator
> index 55c4dfc..0ea6b61 100755
> --- a/generator/generator
> +++ b/generator/generator
> @@ -3284,6 +3284,7 @@ let generate_lib_libnbd_syms () =
> pr "LIBNBD_%d.%d {\n" major minor;
> pr " global:\n";
> if (major, minor) = (1, 0) then (
> + pr " nbd_add_free_callback;\n";
> pr " nbd_create;\n";
> pr " nbd_close;\n&...
2020 Jun 30
0
[PATCH nbdkit 1/5] nbd: Rework the documentation.
...ocket=/path/to/sock>). Remember to use proper
-shell quoting to prevent B<URI> from accidentally being handled as a
-shell glob. The B<uri> parameter is only available when the plugin was
-compiled against libnbd with URI support; C<nbdkit --dump-plugin nbd>
-will contain C<libnbd_uri=1> if this is the case.
-
-=item B<tls=>MODE
-
-Selects which TLS mode to use with the server. If no other tls option
+Selects which TLS mode to use with the server. If no other tls option
is present, this defaults to C<off>, where the client does not attempt
-encryption (and ma...
2020 Jul 01
0
[PATCH nbdkit 1/9] nbd: Rework the documentation.
...ocket=/path/to/sock>). Remember to use proper
-shell quoting to prevent B<URI> from accidentally being handled as a
-shell glob. The B<uri> parameter is only available when the plugin was
-compiled against libnbd with URI support; C<nbdkit --dump-plugin nbd>
-will contain C<libnbd_uri=1> if this is the case.
-
-=item B<tls=>MODE
-
-Selects which TLS mode to use with the server. If no other tls option
+Selects which TLS mode to use with the server. If no other tls option
is present, this defaults to C<off>, where the client does not attempt
-encryption (and ma...