diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 12:26:11 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 12:26:11 +0100 |
commit | b2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18 (patch) | |
tree | 1a8afad7895f932501ff806a5dd3bfc9f2ed5f26 /ocaml | |
parent | 405cf2a5772611ea05cca9fefa843154a9bc64a3 (diff) | |
download | libguestfs-b2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18.tar.gz libguestfs-b2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18.tar.xz libguestfs-b2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18.zip |
Generated code for df / df-h.
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 2 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 6 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 46 |
3 files changed, 54 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index c631024b..52bd54c2 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -291,3 +291,5 @@ external head : t -> string -> string array = "ocaml_guestfs_head" external head_n : t -> int -> string -> string array = "ocaml_guestfs_head_n" 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" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 97180b0d..390b6b9c 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -652,3 +652,9 @@ val tail : t -> string -> string array val tail_n : t -> int -> string -> string array (** return last N lines of a file *) +val df : t -> string +(** report file system disk space usage *) + +val df_h : t -> string +(** report file system disk space usage (human readable) *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index d8b05677..04be8180 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -4542,3 +4542,49 @@ ocaml_guestfs_tail_n (value gv, value nrlinesv, value pathv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_df (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("df: used handle after closing it"); + + char *r; + + caml_enter_blocking_section (); + r = guestfs_df (g); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "df"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_df_h (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("df_h: used handle after closing it"); + + char *r; + + caml_enter_blocking_section (); + r = guestfs_df_h (g); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "df_h"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + |