diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-05-13 17:51:14 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-05-13 17:51:14 +0100 |
commit | e8ecc08f663b44f3d79517affe52f137858dfe00 (patch) | |
tree | 0bee77cb454884699d671f5b1ef264ba4fde5f9e /ocaml | |
parent | 5b17af107f75a0d6f3a39b88b9c18714014eb7af (diff) | |
download | libguestfs-e8ecc08f663b44f3d79517affe52f137858dfe00.tar.gz libguestfs-e8ecc08f663b44f3d79517affe52f137858dfe00.tar.xz libguestfs-e8ecc08f663b44f3d79517affe52f137858dfe00.zip |
Add 'append', LIBGUESTFS_APPEND to set additional kernel options.
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 2 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 6 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 45 |
3 files changed, 53 insertions, 0 deletions
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 @@ -556,6 +556,51 @@ ocaml_guestfs_get_path (value gv) } 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) { CAMLparam2 (gv, autosyncv); |