diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-22 21:02:49 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-22 21:02:49 +0100 |
commit | 79cdf81e2fb717ea4372a55170d16800cdbddf23 (patch) | |
tree | 42b91b69ef02a17c49de10944d249526d63698f6 /ocaml | |
parent | d7ffe439e8ec5304a1a2d1eb591d348c4ab84f38 (diff) | |
download | libguestfs-79cdf81e2fb717ea4372a55170d16800cdbddf23.tar.gz libguestfs-79cdf81e2fb717ea4372a55170d16800cdbddf23.tar.xz libguestfs-79cdf81e2fb717ea4372a55170d16800cdbddf23.zip |
Generated code for new mount_* commands.
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 3 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 9 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 75 |
3 files changed, 87 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index 1cfe9210..96ec6e39 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -208,3 +208,6 @@ external tar_in : t -> string -> string -> unit = "ocaml_guestfs_tar_in" external tar_out : t -> string -> string -> unit = "ocaml_guestfs_tar_out" external tgz_in : t -> string -> string -> unit = "ocaml_guestfs_tgz_in" external tgz_out : t -> string -> string -> unit = "ocaml_guestfs_tgz_out" +external mount_ro : t -> string -> string -> unit = "ocaml_guestfs_mount_ro" +external mount_options : t -> string -> string -> string -> unit = "ocaml_guestfs_mount_options" +external mount_vfs : t -> string -> string -> string -> string -> unit = "ocaml_guestfs_mount_vfs" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 766c3e0e..a332f0b4 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -403,3 +403,12 @@ val tgz_in : t -> string -> string -> unit val tgz_out : t -> string -> string -> unit (** pack directory into compressed tarball *) +val mount_ro : t -> string -> string -> unit +(** mount a guest disk, read-only *) + +val mount_options : t -> string -> string -> string -> unit +(** mount a guest disk with mount options *) + +val mount_vfs : t -> string -> string -> string -> string -> unit +(** mount a guest disk with mount options and vfstype *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index b0f9cdc5..acf8f922 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -2533,3 +2533,78 @@ ocaml_guestfs_tgz_out (value gv, value directoryv, value tarballv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_mount_ro (value gv, value devicev, value mountpointv) +{ + CAMLparam3 (gv, devicev, mountpointv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mount_ro: used handle after closing it"); + + const char *device = String_val (devicev); + const char *mountpoint = String_val (mountpointv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mount_ro (g, device, mountpoint); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mount_ro"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_mount_options (value gv, value optionsv, value devicev, value mountpointv) +{ + CAMLparam4 (gv, optionsv, devicev, mountpointv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mount_options: used handle after closing it"); + + const char *options = String_val (optionsv); + const char *device = String_val (devicev); + const char *mountpoint = String_val (mountpointv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mount_options (g, options, device, mountpoint); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mount_options"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev, value mountpointv) +{ + CAMLparam5 (gv, optionsv, vfstypev, devicev, mountpointv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mount_vfs: used handle after closing it"); + + const char *options = String_val (optionsv); + const char *vfstype = String_val (vfstypev); + const char *device = String_val (devicev); + const char *mountpoint = String_val (mountpointv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mount_vfs"); + + rv = Val_unit; + CAMLreturn (rv); +} + |