search for: print_ocaml_closure_wrapper

Displaying 10 results from an estimated 10 matches for "print_ocaml_closure_wrapper".

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
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...\n" flag_prefix flag; + pr " }\n" + ) flags; + (* Possible if newer libnbd returns value not present in older compilation *) + pr " if (i) abort ();\n"; + pr "\n"; + pr " CAMLreturn (rv);\n"; + pr "}\n"; pr "\n" let print_ocaml_closure_wrapper { cbname; cbargs } = @@ -619,8 +670,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) = | RBool -> pr " rv = Val_bool (r);\n" | RErr -> pr " rv = Val_unit;\n" | RFd | RInt | RUInt -> pr " rv = Val_int (r);\n" - | REnum (_) -> pr &...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...;\n"; + pr " Store_field (rv, 0, v);\n"; + pr " Store_field (rv, 1, cdr);\n"; + pr " }\n"; + pr " }\n"; + pr "\n"; + pr " CAMLreturn (rv);\n"; + pr "}\n"; + pr "\n" + ) let print_ocaml_closure_wrapper { cbname; cbargs } = let argnames = @@ -639,8 +704,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) = | RBool -> pr " rv = Val_bool (r);\n" | RErr -> pr " rv = Val_unit;\n" | RFd | RInt | RUInt -> pr " rv = Val_int (r);\n" - | RE...
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 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...buffer_free\" external to_bytes : t -> bytes = \"nbd_internal_ocaml_buffer_to_bytes\" external of_bytes : bytes -> t = \"nbd_internal_ocaml_buffer_of_bytes\" external size : t -> int = \"nbd_internal_ocaml_buffer_size\" @@ -4945,6 +4940,12 @@ let print_ocaml_closure_wrapper { cbname; cbargs } = pr " int r;\n"; pr " value args[%d];\n" (List.length argnames); pr "\n"; + pr " /* The C callback is always registered, even if there's no OCaml\n"; + pr " * callback. This is because we may need to unregister an...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...+ pr " nbd_%s_callback %s = { .callback = %s_wrapper, .free = %s_free };\n" + cbname cbname cbname cbname | OFlags (n, _) -> pr " uint32_t %s_u32;\n" n; pr " unsigned int %s; /* really uint32_t */\n" n @@ -4984,7 +4978,7 @@ let print_ocaml_closure_wrapper { cbname; cbargs } = pr "/* Wrapper for %s callback. */\n" cbname; pr "static int\n"; pr "%s_wrapper_locked " cbname; - C.print_cbarg_list ~valid_flag:false cbargs; + C.print_cbarg_list cbargs; pr "\n"; pr "{\n"; pr " CAMLp...
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 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 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
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is