summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-13 23:58:33 +0100
committerRichard Jones <rjones@redhat.com>2009-04-13 23:58:33 +0100
commitadefe14e308a0f8cf73f9c60693a3dbbded157b9 (patch)
treecc1ecd798dd05c422ddcf99c1cdbef307aacb8fd /ocaml
parent42283403886da648bb239177369aa65c0a659255 (diff)
downloadlibguestfs-adefe14e308a0f8cf73f9c60693a3dbbded157b9.tar.gz
libguestfs-adefe14e308a0f8cf73f9c60693a3dbbded157b9.tar.xz
libguestfs-adefe14e308a0f8cf73f9c60693a3dbbded157b9.zip
Generated files for file(1) command.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c24
3 files changed, 28 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 58f99dc2..53307944 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -145,3 +145,4 @@ external umount : t -> string -> unit = "ocaml_guestfs_umount"
external mounts : t -> string array = "ocaml_guestfs_mounts"
external umount_all : t -> unit = "ocaml_guestfs_umount_all"
external lvm_remove_all : t -> unit = "ocaml_guestfs_lvm_remove_all"
+external file : t -> string -> string = "ocaml_guestfs_file"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index aaed946f..e3cee18f 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -274,3 +274,6 @@ val umount_all : t -> unit
val lvm_remove_all : t -> unit
(** remove all LVM LVs, VGs and PVs *)
+val file : t -> string -> string
+(** determine file type *)
+
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);
+}
+