From e8ecc08f663b44f3d79517affe52f137858dfe00 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 13 May 2009 17:51:14 +0100 Subject: Add 'append', LIBGUESTFS_APPEND to set additional kernel options. --- ocaml/guestfs.ml | 2 ++ ocaml/guestfs.mli | 6 ++++++ ocaml/guestfs_c_actions.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) (limited to 'ocaml') diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index 39d23293..2544b16b 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -125,6 +125,8 @@ 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_append : t -> string -> unit = "ocaml_guestfs_set_append" +external get_append : t -> string = "ocaml_guestfs_get_append" external set_autosync : t -> bool -> unit = "ocaml_guestfs_set_autosync" external get_autosync : t -> bool = "ocaml_guestfs_get_autosync" external set_verbose : t -> bool -> unit = "ocaml_guestfs_set_verbose" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 21e6eeb5..870ffb69 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -154,6 +154,12 @@ val set_path : t -> string -> unit val get_path : t -> string (** get the search path *) +val set_append : t -> string -> unit +(** add options to kernel command line *) + +val get_append : t -> string +(** get the additional kernel options *) + val set_autosync : t -> bool -> unit (** set autosync mode *) diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index fa352fcc..22e65008 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -555,6 +555,51 @@ ocaml_guestfs_get_path (value gv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_set_append (value gv, value appendv) +{ + CAMLparam2 (gv, appendv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("set_append: used handle after closing it"); + + const char *append = String_val (appendv); + int r; + + caml_enter_blocking_section (); + r = guestfs_set_append (g, append); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "set_append"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_get_append (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("get_append: used handle after closing it"); + + const char *r; + + caml_enter_blocking_section (); + r = guestfs_get_append (g); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "get_append"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +} + CAMLprim value ocaml_guestfs_set_autosync (value gv, value autosyncv) { -- cgit