search for: caml_copy_int32

Displaying 19 results from an estimated 19 matches for "caml_copy_int32".

2011 Aug 11
2
[Hivex] [PATCH] Correct 32-bit to 64-bit call
...31478cd..de911f1 100755 --- a/generator/generator.ml +++ b/generator/generator.ml @@ -1771,7 +1771,7 @@ static void raise_closed (const char *) Noreturn; pr " rv = copy_type_value (r, len, t);\n"; pr " free (r);\n" | RInt32 -> pr " rv = caml_copy_int32 (r);\n" - | RInt64 -> pr " rv = caml_copy_int32 (r);\n" + | RInt64 -> pr " rv = caml_copy_int64 (r);\n" ); pr " CAMLreturn (rv);\n"; -- 1.7.3.1
2019 May 16
0
[nbdkit PATCH v2 08/24] ocaml: Implement .cache script callback
...nT (int, -1); + } + + caml_enter_blocking_section (); + CAMLreturnT (int, Int_val (rv)); +} + +static int +cache_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags) +{ + CAMLparam0 (); + CAMLlocal4 (rv, countv, offsetv, flagsv); + + caml_leave_blocking_section (); + + countv = caml_copy_int32 (count); + offsetv = caml_copy_int32 (offset); + flagsv = Val_flags (flags); + + value args[] = { *(value *) h, countv, offsetv, flagsv }; + rv = caml_callbackN_exn (cache_fn, sizeof args / sizeof args[0], args); + if (Is_exception_result (rv)) { + nbdkit_error ("%s", caml_format_...
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...int_ocaml_binding (name, { args; ret }) = > | BytesIn (n, len) -> > pr " %sv = caml_alloc_string (%s);\n" n len; > pr " memcpy (String_val (%sv), %s, %s);\n" n n len > + | Int n -> > + pr " %sv = caml_copy_int32 (%s);\n" n n This is wrong, it should be: %sv = Val_int (%s); Foo_bar means convert a "bar" to a "foo". In this case you need to convert a C int to an OCaml value. This macro turns into a single bit shift, see my series of articles here: https://rwmj.wordpress.com/2...
2019 Apr 23
0
[PATCH nbdkit v2 1/2] ocaml: Change pread method to avoid leaking heap memory.
...(void *h, void *buf, uint32_t count, uint64_t offset, uint32_t flags) { CAMLparam0 (); - CAMLlocal4 (rv, strv, offsetv, flagsv); + CAMLlocal4 (rv, countv, offsetv, flagsv); + mlsize_t len; caml_leave_blocking_section (); - strv = caml_alloc_string (count); + countv = caml_copy_int32 (count); offsetv = caml_copy_int64 (offset); flagsv = Val_flags (flags); - value args[] = { *(value *) h, strv, offsetv, flagsv }; + value args[] = { *(value *) h, countv, offsetv, flagsv }; rv = caml_callbackN_exn (pread_fn, sizeof args / sizeof args[0], args); if (Is_exception_res...
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...{ args; ret }) = | BytesIn (n, len) -> pr " %sv = caml_alloc_string (%s);\n" n len; pr " memcpy (String_val (%sv), %s, %s);\n" n n len - | Int n -> + | Int n + | ReadStatus n -> pr " %sv = caml_copy_int32 (%s);\n" n n | String n -> pr " %sv = caml_copy_string (%s);\n" n n @@ -4282,6 +4313,8 @@ let print_ocaml_binding (name, { args; ret }) = ) | OCamlArg (Path n) | OCamlArg (String n) -> pr " const char *%s = String_val (%sv);\n&...
2019 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...BytesIn (n, len) -> > pr " %sv = caml_alloc_string (%s);\n" n len; > pr " memcpy (String_val (%sv), %s, %s);\n" n n len > - | Int n -> > + | Int n > + | ReadStatus n -> > pr " %sv = caml_copy_int32 (%s);\n" n n In OCaml, a union type where there is no parameter (as in this case) is represented by an OCaml int, so you can write: %sv = Val_int (%s); > | String n -> > pr " %sv = caml_copy_string (%s);\n" n n > @@ -4282,6 +4313,8 @@ let prin...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...-4021,6 +4110,8 @@ let print_ocaml_binding (name, { args; ret }) = | BytesIn (n, len) -> pr " %sv = caml_alloc_string (%s);\n" n len; pr " memcpy (String_val (%sv), %s, %s);\n" n n len + | Int n -> + pr " %sv = caml_copy_int32 (%s);\n" n n | String n -> pr " %sv = caml_copy_string (%s);\n" n n | UInt64 n -> @@ -4032,7 +4123,7 @@ let print_ocaml_binding (name, { args; ret }) = (* The following not yet implemented for callbacks XXX *) | ArrayAndLen...
2019 Apr 23
4
[PATCH nbdkit v2 0/2] Be careful not to leak server heap memory to the client.
Version 1 was here: https://www.redhat.com/archives/libguestfs/2019-April/msg00144.html Version 2 makes a couple of much larger changes: The OCaml patch changes the API of the pread method so it matches what other language bindings are already doing, ie. get the language plugin to return a newly allocated buffer, check it is long enough, copy out the data. The server patch implements a
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
...->level)); + + Store_field (rv, 4, + Val_opt (err->str1, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 5, + Val_opt (err->str2, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 6, + Val_opt (err->str3, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 7, caml_copy_int32 (err->int1)); + Store_field (rv, 8, caml_copy_int32 (err->int2)); + + CAMLreturn (rv); +} + +static void conn_finalize (value); +static void dom_finalize (value); +static void net_finalize (value); +static void pol_finalize (value); +static void vol_finalize (value); +static void sec_finali...
2010 Jun 28
8
[PATCH] add xl ocaml bindings
...gt;console_port)); + Store_field(v, 3, caml_copy_int64(c_val->console_mfn)); + + CAMLreturn(v); +} + +static value Val_physinfo(struct libxl_physinfo *c_val) +{ + CAMLparam0(); + CAMLlocal2(v, hwcap); + int i; + + hwcap = caml_alloc_tuple(8); + for (i = 0; i < 8; i++) + Store_field(hwcap, i, caml_copy_int32(c_val->hw_cap[i])); + + v = caml_alloc_tuple(11); + Store_field(v, 0, Val_int(c_val->threads_per_core)); + Store_field(v, 1, Val_int(c_val->cores_per_socket)); + Store_field(v, 2, Val_int(c_val->max_cpu_id)); + Store_field(v, 3, Val_int(c_val->nr_cpus)); + Store_field(v, 4, Val_int(c...
2019 Dec 16
3
[v2v PATCH 0/2] Move libvirt-ocaml copy to v2v repo
libvirt-ocaml is used only by virt-v2v, so move it to this repository, instead of having it around in the common submodule. The removal from common will happen later. Pino Toscano (2): common: Bundle the libvirt-ocaml library for use by virt-v2v build: switch embedded copy of libvirt-ocaml .gitignore | 2 + 3rdparty/libvirt-ocaml/Makefile.am |
2018 Aug 30
8
[PATCH 0/7] RFC: switch v2v to ocaml-libvirt
Hi, this is a mostly done attempt to switch to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not
2018 Nov 27
8
[PATCH v2 0/7] RFC: switch v2v to ocaml-libvirt
Hi, this is a mostly done attempt to switch to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not
2019 Jan 30
8
[PATCH v3 0/7] RFC: switch v2v to ocaml-libvirt
Hi, this is a mostly done attempt to switch to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not
2019 May 20
8
[PATCH v5 0/7] v2v: switch to ocaml-libvirt
Hi, this series switches virt-2v to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not test all
2019 Jun 18
17
[libnbd PATCH 0/8] Add nbd_pread_callback
I've mentioned this topic before (in fact, the idea of adding NBD_CMD_FLAG_DF was first mentioned at [1]), but finally finished enough of an implementation to feel confident in posting it. I'd still like to add something under examples/ that uses the new API to implement strict checking of a server's structured replies read implementation (ensure that a server never sends data after
2019 Apr 08
12
[PATCH 43 0/7] v2v: switch to ocaml-libvirt
Hi, this series switches virt-2v to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not test all
2019 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1: - rework .can_cache to be tri-state, with default of no advertisement (ripple effect through other patches) - add a lot more patches in order to round out filter support And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so in theory we now have a way to test cache commands through the entire stack. Eric Blake (24): server: Internal hooks for implementing
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...pr " v = caml_alloc_string (32);\n"; - pr " memcpy (String_val (v), %s->%s, 32);\n" typ name - | name, (FBytes|FInt64|FUInt64) -> - pr " v = caml_copy_int64 (%s->%s);\n" typ name - | name, (FInt32|FUInt32) -> - pr " v = caml_copy_int32 (%s->%s);\n" typ name - | name, FOptPercent -> - pr " if (%s->%s >= 0) { /* Some %s */\n" typ name name; - pr " v2 = caml_copy_double (%s->%s);\n" typ name; - pr " v = caml_alloc (1, 0);\n"; - pr " Store...