From adefe14e308a0f8cf73f9c60693a3dbbded157b9 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 13 Apr 2009 23:58:33 +0100 Subject: Generated files for file(1) command. --- ocaml/guestfs_c_actions.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ocaml/guestfs_c_actions.c') diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 6b1a9f62..decb8383 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -1665,3 +1665,27 @@ ocaml_guestfs_lvm_remove_all (value gv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_file (value gv, value pathv) +{ + CAMLparam2 (gv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("file: used handle after closing it"); + + const char *path = String_val (pathv); + char *r; + + caml_enter_blocking_section (); + r = guestfs_file (g, path); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "file"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + -- cgit