summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:00:46 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:00:46 +0100
commitac286b26df1aabceca26dac66c325a3676ace4cc (patch)
treee35289262967573c2ceb56ce67f66d7e678dba41 /ocaml
parent3cb794463a62239e36d730bc5d2d3eb4c7a66096 (diff)
downloadlibguestfs-ac286b26df1aabceca26dac66c325a3676ace4cc.tar.gz
libguestfs-ac286b26df1aabceca26dac66c325a3676ace4cc.tar.xz
libguestfs-ac286b26df1aabceca26dac66c325a3676ace4cc.zip
Generated code for cp, cp-a and mv commands.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml3
-rw-r--r--ocaml/guestfs.mli9
-rw-r--r--ocaml/guestfs_c_actions.c72
3 files changed, 84 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index b61931eb..f196ea15 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -222,3 +222,6 @@ external get_e2uuid : t -> string -> string = "ocaml_guestfs_get_e2uuid"
external fsck : t -> string -> string -> int = "ocaml_guestfs_fsck"
external zero : t -> string -> unit = "ocaml_guestfs_zero"
external grub_install : t -> string -> string -> unit = "ocaml_guestfs_grub_install"
+external cp : t -> string -> string -> unit = "ocaml_guestfs_cp"
+external cp_a : t -> string -> string -> unit = "ocaml_guestfs_cp_a"
+external mv : t -> string -> string -> unit = "ocaml_guestfs_mv"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index c8b67958..60ec056d 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -445,3 +445,12 @@ val zero : t -> string -> unit
val grub_install : t -> string -> string -> unit
(** install GRUB *)
+val cp : t -> string -> string -> unit
+(** copy a file *)
+
+val cp_a : t -> string -> string -> unit
+(** copy a file or directory recursively *)
+
+val mv : t -> string -> string -> unit
+(** move a file *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index 0656e726..f4c18088 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -2870,3 +2870,75 @@ ocaml_guestfs_grub_install (value gv, value rootv, value devicev)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_cp (value gv, value srcv, value destv)
+{
+ CAMLparam3 (gv, srcv, destv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("cp: used handle after closing it");
+
+ const char *src = String_val (srcv);
+ const char *dest = String_val (destv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_cp (g, src, dest);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "cp");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_cp_a (value gv, value srcv, value destv)
+{
+ CAMLparam3 (gv, srcv, destv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("cp_a: used handle after closing it");
+
+ const char *src = String_val (srcv);
+ const char *dest = String_val (destv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_cp_a (g, src, dest);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "cp_a");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mv (value gv, value srcv, value destv)
+{
+ CAMLparam3 (gv, srcv, destv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mv: used handle after closing it");
+
+ const char *src = String_val (srcv);
+ const char *dest = String_val (destv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mv (g, src, dest);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mv");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+