summaryrefslogtreecommitdiffstats
path: root/ocaml/guestfs_c_actions.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-22 09:00:39 +0100
committerRichard Jones <rjones@redhat.com>2009-04-22 09:00:39 +0100
commit43db06ea892cc157324a6b837ca430607441c509 (patch)
treefc377195fcfda3b163d8f184a6965bb64b1bb018 /ocaml/guestfs_c_actions.c
parent54dd7be5855055a698291084c0074a1abac7b921 (diff)
downloadlibguestfs-43db06ea892cc157324a6b837ca430607441c509.tar.gz
libguestfs-43db06ea892cc157324a6b837ca430607441c509.tar.xz
libguestfs-43db06ea892cc157324a6b837ca430607441c509.zip
Allow qemu binary to be overridden at runtime.
Diffstat (limited to 'ocaml/guestfs_c_actions.c')
-rw-r--r--ocaml/guestfs_c_actions.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index cfcf4e4c..b0f9cdc5 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -466,6 +466,51 @@ ocaml_guestfs_config (value gv, value qemuparamv, value qemuvaluev)
}
CAMLprim value
+ocaml_guestfs_set_qemu (value gv, value qemuv)
+{
+ CAMLparam2 (gv, qemuv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("set_qemu: used handle after closing it");
+
+ const char *qemu = String_val (qemuv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_set_qemu (g, qemu);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "set_qemu");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_qemu (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("get_qemu: used handle after closing it");
+
+ const char *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_get_qemu (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "get_qemu");
+
+ rv = caml_copy_string (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
ocaml_guestfs_set_path (value gv, value pathv)
{
CAMLparam2 (gv, pathv);