summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml2
-rw-r--r--ocaml/guestfs.mli6
-rw-r--r--ocaml/guestfs_c_actions.c45
3 files changed, 53 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 3ca33f7b..1cfe9210 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -121,6 +121,8 @@ external kill_subprocess : t -> unit = "ocaml_guestfs_kill_subprocess"
external add_drive : t -> string -> unit = "ocaml_guestfs_add_drive"
external add_cdrom : t -> string -> unit = "ocaml_guestfs_add_cdrom"
external config : t -> string -> string option -> unit = "ocaml_guestfs_config"
+external set_qemu : t -> string -> unit = "ocaml_guestfs_set_qemu"
+external get_qemu : t -> string = "ocaml_guestfs_get_qemu"
external set_path : t -> string -> unit = "ocaml_guestfs_set_path"
external get_path : t -> string = "ocaml_guestfs_get_path"
external set_autosync : t -> bool -> unit = "ocaml_guestfs_set_autosync"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index 629e443e..766c3e0e 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -142,6 +142,12 @@ val add_cdrom : t -> string -> unit
val config : t -> string -> string option -> unit
(** add qemu parameters *)
+val set_qemu : t -> string -> unit
+(** set the qemu binary *)
+
+val get_qemu : t -> string
+(** get the qemu binary *)
+
val set_path : t -> string -> unit
(** set the search path *)
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);