summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:43 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:43 +0100
commit1fc41b39dac877ccec1284da8bb14baa4df368b8 (patch)
tree74d0693b6d97d796b75847ace4815109c17b3198 /ocaml
parentd1df2f342489bbbba086cae2bb95971c8e404cad (diff)
downloadlibguestfs-1fc41b39dac877ccec1284da8bb14baa4df368b8.tar.gz
libguestfs-1fc41b39dac877ccec1284da8bb14baa4df368b8.tar.xz
libguestfs-1fc41b39dac877ccec1284da8bb14baa4df368b8.zip
Generated code for 'find' command.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c26
3 files changed, 30 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 561b93c3..0fe2d821 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -245,3 +245,4 @@ external vg_activate_all : t -> bool -> unit = "ocaml_guestfs_vg_activate_all"
external vg_activate : t -> bool -> string array -> unit = "ocaml_guestfs_vg_activate"
external lvresize : t -> string -> int -> unit = "ocaml_guestfs_lvresize"
external resize2fs : t -> string -> unit = "ocaml_guestfs_resize2fs"
+external find : t -> string -> string array = "ocaml_guestfs_find"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index d9ce4af5..f7585527 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -514,3 +514,6 @@ val lvresize : t -> string -> int -> unit
val resize2fs : t -> string -> unit
(** resize an ext2/ext3 filesystem *)
+val find : t -> string -> string array
+(** find all files and directories *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index c64bcf09..0dcaf3f3 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -3426,3 +3426,29 @@ ocaml_guestfs_resize2fs (value gv, value devicev)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_find (value gv, value directoryv)
+{
+ CAMLparam2 (gv, directoryv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("find: used handle after closing it");
+
+ const char *directory = String_val (directoryv);
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_find (g, directory);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "find");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+