diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-20 00:22:02 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-20 00:22:02 +0100 |
commit | 170f262f0413de843af62b968f6d12c1c476ae7f (patch) | |
tree | b9be7ae0e59f784dfdd57ef063536218ee3f0c7d /ocaml | |
parent | d5151686d82b66c50935010fd5458be0e4386bab (diff) | |
download | libguestfs-170f262f0413de843af62b968f6d12c1c476ae7f.tar.gz libguestfs-170f262f0413de843af62b968f6d12c1c476ae7f.tar.xz libguestfs-170f262f0413de843af62b968f6d12c1c476ae7f.zip |
Implement upload and download commands.
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 | 44 |
3 files changed, 52 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index f45533bb..09b12b1c 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -132,6 +132,8 @@ external is_config : t -> bool = "ocaml_guestfs_is_config" external is_launching : t -> bool = "ocaml_guestfs_is_launching" external is_busy : t -> bool = "ocaml_guestfs_is_busy" external get_state : t -> int = "ocaml_guestfs_get_state" +external set_busy : t -> unit = "ocaml_guestfs_set_busy" +external set_ready : t -> unit = "ocaml_guestfs_set_ready" external mount : t -> string -> string -> unit = "ocaml_guestfs_mount" external sync : t -> unit = "ocaml_guestfs_sync" external touch : t -> string -> unit = "ocaml_guestfs_touch" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 2257fc0c..dfc17842 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -175,6 +175,12 @@ val is_busy : t -> bool val get_state : t -> int (** get the current state *) +val set_busy : t -> unit +(** set state to busy *) + +val set_ready : t -> unit +(** set state to ready *) + val mount : t -> string -> string -> unit (** mount a guest disk at a position in the filesystem *) diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 4d7b350a..138f0fd1 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -711,6 +711,50 @@ ocaml_guestfs_get_state (value gv) } CAMLprim value +ocaml_guestfs_set_busy (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("set_busy: used handle after closing it"); + + int r; + + caml_enter_blocking_section (); + r = guestfs_set_busy (g); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "set_busy"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_set_ready (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("set_ready: used handle after closing it"); + + int r; + + caml_enter_blocking_section (); + r = guestfs_set_ready (g); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "set_ready"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value ocaml_guestfs_mount (value gv, value devicev, value mountpointv) { CAMLparam3 (gv, devicev, mountpointv); |