summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 12:47:20 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 12:47:20 +0100
commite492608f2f3809a824cb70ee03ff305964b69dd7 (patch)
tree953ec56c34431549dab177eec9e0fe979606e5eb /ocaml
parent9a92446bcad09b492dee42dd5950bac67073fbea (diff)
downloadlibguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.tar.gz
libguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.tar.xz
libguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.zip
Generated code for 'du' command.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c23
3 files changed, 27 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 52bd54c2..90f3ca8d 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -293,3 +293,4 @@ external tail : t -> string -> string array = "ocaml_guestfs_tail"
external tail_n : t -> int -> string -> string array = "ocaml_guestfs_tail_n"
external df : t -> string = "ocaml_guestfs_df"
external df_h : t -> string = "ocaml_guestfs_df_h"
+external du : t -> string -> int64 = "ocaml_guestfs_du"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index 390b6b9c..39df5045 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -658,3 +658,6 @@ val df : t -> string
val df_h : t -> string
(** report file system disk space usage (human readable) *)
+val du : t -> string -> int64
+(** estimate file space usage *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index 04be8180..a5e18940 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -4588,3 +4588,26 @@ ocaml_guestfs_df_h (value gv)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_du (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("du: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int64_t r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_du (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "du");
+
+ rv = caml_copy_int64 (r);
+ CAMLreturn (rv);
+}
+