Displaying 7 results from an estimated 7 matches for "list_exports_wrapper".
2020 Sep 01
3
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...quot; };
+ { name = "name2"; description = None } ]
let ocamlexample_default_export ro tls =
"name1"
diff --git i/plugins/ocaml/ocaml.c w/plugins/ocaml/ocaml.c
index a34f67ca..ea499454 100644
--- i/plugins/ocaml/ocaml.c
+++ w/plugins/ocaml/ocaml.c
@@ -332,11 +332,12 @@ list_exports_wrapper (int readonly, int is_tls,
struct nbdkit_exports *exports)
/* Convert exports list into calls to nbdkit_add_export. */
while (rv != Val_int (0)) {
- const char *name, *desc;
+ const char *name, *desc = NULL;
v = Field (rv, 0); /* export struct */
name = String_...
2020 Sep 01
0
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...;
printf ("Some %s\n", String_val (sv));
}
The weird casting macros have the form: To_from()
Also that String_val is only valid for a short period of time,
basically until the next OCaml allocation in the current thread.
> +++ w/plugins/ocaml/ocaml.c
> @@ -332,11 +332,12 @@ list_exports_wrapper (int readonly, int
> is_tls, struct nbdkit_exports *exports)
>
> /* Convert exports list into calls to nbdkit_add_export. */
> while (rv != Val_int (0)) {
> - const char *name, *desc;
> + const char *name, *desc = NULL;
>
> v = Field (rv, 0); /* e...
2020 Sep 01
1
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...The weird casting macros have the form: To_from()
>
> Also that String_val is only valid for a short period of time,
> basically until the next OCaml allocation in the current thread.
That's helpful, as well.
>
>> +++ w/plugins/ocaml/ocaml.c
>> @@ -332,11 +332,12 @@ list_exports_wrapper (int readonly, int
>> is_tls, struct nbdkit_exports *exports)
>>
>> /* Convert exports list into calls to nbdkit_add_export. */
>> while (rv != Val_int (0)) {
>> - const char *name, *desc;
>> + const char *name, *desc = NULL;
>>
>>...
2020 Sep 01
0
[nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...static value default_export_fn;
static value open_fn;
static value close_fn;
static value get_size_fn;
+static value export_description_fn;
static value can_cache_fn;
static value can_extents_fn;
@@ -311,6 +314,64 @@ preconnect_wrapper (int readonly)
CAMLreturnT (int, 0);
}
+static int
+list_exports_wrapper (int readonly, int is_tls, struct nbdkit_exports *exports)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (rv, v);
+
+ caml_leave_blocking_section ();
+
+ rv = caml_callback2_exn (list_exports_fn, Val_bool (readonly),
+ Val_bool (is_tls));
+ if (Is_exception_result (rv)) {
+ nbd...
2020 Sep 21
0
[nbdkit PATCH v3 14/14] ocaml: Implement .list_exports and friends
...static value default_export_fn;
static value open_fn;
static value close_fn;
static value get_size_fn;
+static value export_description_fn;
static value can_cache_fn;
static value can_extents_fn;
@@ -311,6 +314,65 @@ preconnect_wrapper (int readonly)
CAMLreturnT (int, 0);
}
+static int
+list_exports_wrapper (int readonly, int is_tls, struct nbdkit_exports *exports)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (rv, v);
+
+ caml_leave_blocking_section ();
+
+ rv = caml_callback2_exn (list_exports_fn, Val_bool (readonly),
+ Val_bool (is_tls));
+ if (Is_exception_result (rv)) {
+ nbd...
2020 Sep 01
4
[nbdkit PATCH 0/2] More language bindings for .list_exports
This picks up python and ocaml. Some of our languages are lacking a
number of bindings (for example, lua and perl lack .extents, so I
didn't have anything to copy from), and I felt less comfortable with
golang and rust. But for python and ocaml, I was able to test a
working implementation.
Eric Blake (2):
python: Implement .list_exports and friends
ocaml: Implement .list_exports and
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by
improving libnbd to better test things, which in turn surfaced some
major memory leak problems in nbdsh that are now fixed). Many of the
patches are minor rebases from v2, with the biggest changes being
fallout from:
- patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export
- overall: this missed 1.22, so update