search for: val_unit

Displaying 20 results from an estimated 105 matches for "val_unit".

2010 Jun 28
8
[PATCH] add xl ocaml bindings
...ibxl_device_disk c_info; + struct libxl_ctx ctx; + int ret; + + device_disk_val(&c_info, info); + c_info.domid = Int_val(domid); + + INIT_CTX(); + ret = libxl_device_disk_add(&ctx, Int_val(domid), &c_info); + if (ret != 0) + failwith_xl("disk_add"); + FREE_CTX(); + CAMLreturn(Val_unit); +} + +value stub_xl_disk_remove(value info, value domid) +{ + CAMLparam2(info, domid); + libxl_device_disk c_info; + struct libxl_ctx ctx; + int ret; + + device_disk_val(&c_info, info); + c_info.domid = Int_val(domid); + + INIT_CTX(); + ret = libxl_device_disk_del(&ctx, &c_info, 0); +...
2013 Mar 13
0
[PATCH 3 of 4] PoC: libxc+ocaml: add interfaces to send triggers to HVM guests
...handle -> version = "stub_xc_version_version" diff -r b279ec057736 -r 03997417771b tools/ocaml/libs/xc/xenctrl_stubs.c --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1247,6 +1247,20 @@ CAMLprim value stub_xc_domain_set_vpt_al CAMLreturn(Val_unit); } +CAMLprim value stub_xc_domain_trigger_power(value xch, value domid) +{ + CAMLparam2(xch, domid); + xc_domain_trigger_power(_H(xch), _D(domid)); + CAMLreturn(Val_unit); +} + +CAMLprim value stub_xc_domain_trigger_sleep(value xch, value domid) +{ + CAMLparam2(xch, domid); + xc_domain_trigger_...
2017 Mar 23
0
[PATCH v5 03/10] mllib: ocaml wrapper for lib/osinfo
...sinfo_db (value gv, value fv) +{ + CAMLparam2 (gv, fv); + guestfs_h *g = (guestfs_h *) Int64_val (gv); + struct callback_wrapper_args args; + + /* This stack address is used to point to the exception, if one is + * raised in the visitor_function. Note that the macro initializes + * this to Val_unit, which is how we know if an exception was set. + */ + CAMLlocal1 (exn); + + exn = Val_unit; + + args.exnp = &exn; + args.fvp = &fv; + + if (read_osinfo_db (g, read_osinfo_db_callback_wrapper, &args) == -1) { + if (exn != Val_unit) { + /* The failure was caused by the call...
2017 Apr 12
0
[PATCH v6 03/10] mllib: ocaml wrapper for lib/osinfo
...sinfo_db (value gv, value fv) +{ + CAMLparam2 (gv, fv); + guestfs_h *g = (guestfs_h *) Int64_val (gv); + struct callback_wrapper_args args; + + /* This stack address is used to point to the exception, if one is + * raised in the visitor_function. Note that the macro initializes + * this to Val_unit, which is how we know if an exception was set. + */ + CAMLlocal1 (exn); + + exn = Val_unit; + + args.exnp = &exn; + args.fvp = &fv; + + if (read_osinfo_db (g, read_osinfo_db_callback_wrapper, &args) == -1) { + if (exn != Val_unit) { + /* The failure was caused by the call...
2013 Mar 25
86
[PATCH 00/28] libxl: ocaml: improve the bindings
The following series of patches fill in most of the gaps in the OCaml bindings to libxl, to make them useful for clients such as xapi/xenopsd (from XCP). There are a number of bugfixes to the existing bindings as well. I have an experimental version of xenopsd that successfully uses the new bindings. An earlier version of the first half of the series was submitted to the last by Ian Campbell on
2019 Mar 22
8
[PATCH 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Pino Toscano (4): common/mltools: move the code for machine readable up common/mltools: make sure machine
2016 Sep 19
0
[PATCH 2/3] mllib: expose disk decrypt functionalities
...with the guestfish inspection and decryption code. */ +int echo_keys = 0; +int keys_from_stdin = 0; + +value +guestfs_int_mllib_inspect_decrypt (value gv, value gpv) +{ + CAMLparam2 (gv, gpv); + guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gpv); + + inspect_do_decrypt (g); + + CAMLreturn (Val_unit); +} + +/* NB: This is a "noalloc" call. */ +value +guestfs_int_mllib_set_echo_keys (value unitv) +{ + echo_keys = 1; + return Val_unit; +} + +/* NB: This is a "noalloc" call. */ +value +guestfs_int_mllib_set_keys_from_stdin (value unitv) +{ + keys_from_stdin = 1; + return V...
2019 Mar 22
0
[PATCH 4/4] OCaml tools: output messages into JSON for machine readable
...+value +guestfs_int_mllib_rfc3999_date_time_string (value unitv) +{ + CAMLparam1 (unitv); + char buf[64]; + struct timespec ts; + struct tm tm; + size_t ret; + size_t total = 0; + + if (clock_gettime (CLOCK_REALTIME, &ts) == -1) + unix_error (errno, (char *) "clock_gettime", Val_unit); + + if (localtime_r (&ts.tv_sec, &tm) == NULL) + unix_error (errno, (char *) "localtime_r", caml_copy_int64 (ts.tv_sec)); + + /* Sadly strftime does not support nanoseconds, so what we do is: + * - stringify everything before the nanoseconds + * - print the nanoseconds...
2017 Feb 10
0
[PATCH v3 06/10] mllib: ocaml wrapper for lib/osinfo
...sinfo_db (value gv, value fv) +{ + CAMLparam2 (gv, fv); + guestfs_h *g = (guestfs_h *) Int64_val (gv); + struct callback_wrapper_args args; + + /* This stack address is used to point to the exception, if one is + * raised in the visitor_function. Note that the macro initializes + * this to Val_unit, which is how we know if an exception was set. + */ + CAMLlocal1 (exn); + + args.exnp = &exn; + args.fvp = &fv; + + if (read_osinfo_db (g, read_osinfo_db_callback_wrapper, &args) == -1) { + if (exn != Val_unit) { + /* The failure was caused by the callback raising an +...
2017 Mar 07
0
[PATCH v4 3/9] mllib: ocaml wrapper for lib/osinfo
...sinfo_db (value gv, value fv) +{ + CAMLparam2 (gv, fv); + guestfs_h *g = (guestfs_h *) Int64_val (gv); + struct callback_wrapper_args args; + + /* This stack address is used to point to the exception, if one is + * raised in the visitor_function. Note that the macro initializes + * this to Val_unit, which is how we know if an exception was set. + */ + CAMLlocal1 (exn); + + args.exnp = &exn; + args.fvp = &fv; + + if (read_osinfo_db (g, read_osinfo_db_callback_wrapper, &args) == -1) { + if (exn != Val_unit) { + /* The failure was caused by the callback raising an +...
2019 Aug 15
2
[nbdkit PATCH] ocaml: Add support for dynamic .thread_model
...ml. */ @@ -683,18 +686,30 @@ cache_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags) CAMLreturnT (int, 0); } +static int +thread_model_wrapper (void) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + + caml_leave_blocking_section (); + + rv = caml_callback_exn (config_complete_fn, Val_unit); + if (Is_exception_result (rv)) { + nbdkit_error ("%s", caml_format_exception (Extract_exception (rv))); + caml_enter_blocking_section (); + CAMLreturnT (int, -1); + } + + caml_enter_blocking_section (); + CAMLreturnT (int, Int_val (rv)); +} + /*---------------------------...
2017 Jul 31
0
[PATCH v11 02/10] daemon: Embed the ocaml-augeas library in the daemon.
...urn (Val_augeas_t (t)); +} + +/* val close : t -> unit */ +CAMLprim value +ocaml_augeas_close (value tv) +{ + CAMLparam1 (tv); + augeas_t t = Augeas_t_val (tv); + + if (t) { + aug_close (t); + Augeas_t_val(tv) = NULL; /* So the finalizer doesn't double-free. */ + } + + CAMLreturn (Val_unit); +} + +/* val get : t -> path -> value option */ +CAMLprim value +ocaml_augeas_get (value tv, value pathv) +{ + CAMLparam2 (tv, pathv); + CAMLlocal2 (optv, v); + augeas_t t = Augeas_t_val (tv); + char *path = String_val (pathv); + const char *val; + int r; + + r = aug_get (t, path, &a...
2019 Mar 28
0
[PATCH v2 4/4] OCaml tools: output messages into JSON for machine readable
...keys_from_stdin (value unitv); +extern value guestfs_int_mllib_rfc3999_date_time_string (value unitv); /* Interface with the guestfish inspection and decryption code. */ int echo_keys = 0; @@ -103,3 +106,51 @@ guestfs_int_mllib_set_keys_from_stdin (value unitv) keys_from_stdin = 1; return Val_unit; } + +value +guestfs_int_mllib_rfc3999_date_time_string (value unitv) +{ + CAMLparam1 (unitv); + char buf[64]; + struct timespec ts; + struct tm tm; + size_t ret; + size_t total = 0; + + if (clock_gettime (CLOCK_REALTIME, &ts) == -1) + unix_error (errno, (char *) "clock_gettime&...
2017 Aug 09
0
[PATCH v12 02/11] common: Bundle the ocaml-augeas library for use by the daemon.
...urn (Val_augeas_t (t)); +} + +/* val close : t -> unit */ +CAMLprim value +ocaml_augeas_close (value tv) +{ + CAMLparam1 (tv); + augeas_t t = Augeas_t_val (tv); + + if (t) { + aug_close (t); + Augeas_t_val(tv) = NULL; /* So the finalizer doesn't double-free. */ + } + + CAMLreturn (Val_unit); +} + +/* val get : t -> path -> value option */ +CAMLprim value +ocaml_augeas_get (value tv, value pathv) +{ + CAMLparam2 (tv, pathv); + CAMLlocal2 (optv, v); + augeas_t t = Augeas_t_val (tv); + char *path = String_val (pathv); + const char *val; + int r; + + r = aug_get (t, path, &a...
2015 Dec 02
4
[PATCH 0/3] supermin: add --include-packagelist
Hi, to ease debugging issues with appliances (e.g. when used in libguestfs), using --include-packagelist will add a file containing the list of all the packages used. Thanks, Pino Toscano (3): ext2: add ext2fs_chmod and ext2fs_chown chroot: factor out file copy code Add --include-packagelist src/build.ml | 42 +++++++++++++++++++++++++------ src/chroot.ml | 29
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
...CAMLreturn (b ? Val_true : Val_false); +" + } elsif ($sig =~ /^(\w+), bool : unit$/) { + "\ + " . gen_unpack_args ($1) . " + int r, b; + + b = bv == Val_true ? 1 : 0; + + NONBLOCKING (r = $c_name ($1, b)); + CHECK_ERROR (r == -1, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig eq "conn, int : int array") { + "\ + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + int *ids, r; + + /* Some libvirt List* functions still throw exceptions if i == 0, + * so catch that and return an empty arr...
2014 Jul 30
2
[PATCH 1/3] ext2: create a struct for the OCaml 't' type
...; - fsv = Val_ext2fs (fs); + fsv = Val_ext2fs (&data); CAMLreturn (fsv); } @@ -145,7 +150,7 @@ supermin_ext2fs_close (value fsv) ext2_finalize (fsv); /* So we don't double-free in the finalizer. */ - Ext2fs_val (fsv) = NULL; + Ext2fs_val (fsv).fs = NULL; CAMLreturn (Val_unit); } @@ -154,14 +159,14 @@ value supermin_ext2fs_read_bitmaps (value fsv) { CAMLparam1 (fsv); - ext2_filsys fs; + struct ext2_data data; errcode_t err; - fs = Ext2fs_val (fsv); - if (fs == NULL) + data = Ext2fs_val (fsv); + if (data.fs == NULL) ext2_handle_closed (); - err =...
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...doc_finalize, + custom_finalize_default, custom_compare_default, custom_hash_default, custom_serialize_default, custom_deserialize_default }; +value +v2v_xml_free_doc_ptr (value docv) +{ + CAMLparam1 (docv); + xmlDocPtr doc = Doc_val (docv); + + xmlFreeDoc (doc); + CAMLreturn (Val_unit); +} + /* xmlXPathContextPtr type */ -#define Xpathctx_val(v) (*((xmlXPathContextPtr *)Data_custom_val(v))) +#define Xpathctx_ptr_val(v) (*((xmlXPathContextPtr *)Data_custom_val(v))) -static void -xpathctx_finalize (value xpathctxv) -{ - xmlXPathContextPtr xpathctx = Xpathctx_val (xpathctxv); -...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...;, - doc_finalize, + custom_finalize_default, custom_compare_default, custom_hash_default, custom_serialize_default, custom_deserialize_default }; +value +v2v_xml_free_doc (value docv) +{ + CAMLparam1 (docv); + xmlDocPtr doc = Doc_val (docv); + + xmlFreeDoc (doc); + CAMLreturn (Val_unit); +} + /* xmlXPathContextPtr type */ -#define Xpathctx_val(v) (*((xmlXPathContextPtr *)Data_custom_val(v))) +#define Xpathctx_ptr_val(v) (*((xmlXPathContextPtr *)Data_custom_val(v))) -static void -xpathctx_finalize (value xpathctxv) -{ - xmlXPathContextPtr xpathctx = Xpathctx_val (xpathctxv); -...
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 |