X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=a5e189405bccb6a67da459541b2c2212b1373e33;hp=04be818009ffa6dcdeb8f98d75d59fdce953439b;hb=e492608f2f3809a824cb70ee03ff305964b69dd7;hpb=9a92446bcad09b492dee42dd5950bac67073fbea diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 04be818..a5e1894 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); +} +