search for: bytes_v

Displaying 9 results from an estimated 9 matches for "bytes_v".

Did you mean: bytes_s
2019 Jun 12
4
[libnbd PATCH] Fix building with for ocaml < 4.06.0
...| 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ocaml/nbd-c.h b/ocaml/nbd-c.h index 558581850807..45ae64d77209 100644 --- a/ocaml/nbd-c.h +++ b/ocaml/nbd-c.h @@ -27,6 +27,11 @@ #include <caml/memory.h> #include <caml/mlvalues.h> +// Workaround for OCaml < 4.06.0 +#ifndef Bytes_val +#define Bytes_val(x) String_val(x) +#endif + extern void libnbd_finalize (value); extern void nbd_buffer_finalize (value); -- 2.21.0
2019 Aug 12
0
[PATCH libnbd 3/7] ocaml: Remove NBD.Buffer.free function, use a free callback instead.
...pr " free_root (NULL, user_data);\n"; pr "\n"; pr " return ret;\n"; pr "}\n"; @@ -5313,17 +5306,39 @@ let print_ocaml_binding (name, { args; optargs; ret }) = | BytesIn (n, count) -> pr " const void *%s = Bytes_val (%sv);\n" n n; pr " size_t %s = caml_string_length (%sv);\n" count n + | BytesOut (n, count) -> + pr " void *%s = Bytes_val (%sv);\n" n n; + pr " size_t %s = caml_string_length (%sv);\n" count n | BytesPersistIn (n, count) ->...
2019 Jun 12
0
Re: [libnbd PATCH] Fix building with for ocaml < 4.06.0
...y for OCaml < 4.06.0 and > properly detecting and reporting that, was a bit ugly. I prefer the lightweight approach - all the more configure.ac does is add the ability to do #ifdef-ery probing on things that don't originally come with enough #ifdef witnesses; but here, the absence of Bytes_val is all the more that you would probe for in configure.ac, making it not worth the effort to add yet another macro just to work around the problem. Which platform are you compiling on, and what OCaml version are you using? That said, I don't see any reason to not commit this patch. -- Eric...
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...aml_buffer_to_bytes (value bv) CAMLlocal1 (rv); struct nbd_buffer *b = NBD_buffer_val (bv); - if (b->data == NULL) /* Buffer has been freed. */ - caml_invalid_argument ("NBD.Buffer.to_bytes used on freed buffer"); - rv = caml_alloc_string (b->len); memcpy (Bytes_val (rv), b->data, b->len); diff --git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml index 8057118..d5dcc60 100644 --- a/ocaml/examples/asynch_copy.ml +++ b/ocaml/examples/asynch_copy.ml @@ -31,11 +31,9 @@ let asynch_copy src dst = in (* This callback is called when...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...pr " %s = 0;\n" n - | OCamlArg (Bool n) -> + ) optargs; + + List.iter ( + function + | Bool n -> pr " bool %s = Bool_val (%sv);\n" n n - | OCamlArg (BytesIn (n, count)) -> + | BytesIn (n, count) -> pr " const void *%s = Bytes_val (%sv);\n" n n; pr " size_t %s = caml_string_length (%sv);\n" count n - | OCamlArg (BytesPersistIn (n, count)) -> + | BytesPersistIn (n, count) -> pr " struct nbd_buffer *%s_buf = NBD_buffer_val (%sv);\n" n n; pr " const void *%s...
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 09
4
[PATCH libnbd 0/2] generator: Preparatory changes to the generator.
These are some simplifications to the generator. They don't probably make much sense on their own, but they are preparatory to better handling of enums, and or'd lists of flags. Rich.
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