From 1fc41b39dac877ccec1284da8bb14baa4df368b8 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 19 May 2009 12:05:43 +0100 Subject: Generated code for 'find' command. --- ocaml/guestfs_c_actions.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ocaml/guestfs_c_actions.c') 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); +} + -- cgit