X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=f26226c04db6b134f686bbd4638dd339f3c32a83;hb=d19ceb226c242844467b2935c1e19b989b4315e8;hp=f21d63ecd7e21e62722befdcccadc10678031304;hpb=e7eca50046e9a69dac27c0bee832af0a3014e02c;p=libguestfs.git diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index f21d63e..f26226c 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -1157,3 +1157,29 @@ ocaml_guestfs_aug_load (value gv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_aug_ls (value gv, value pathv) +{ + CAMLparam2 (gv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("aug_ls: used handle after closing it"); + + const char *path = String_val (pathv); + int i; + char **r; + + caml_enter_blocking_section (); + r = guestfs_aug_ls (g, path); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "aug_ls"); + + rv = caml_copy_string_array ((const char **) r); + for (i = 0; r[i] != NULL; ++i) free (r[i]); + free (r); + CAMLreturn (rv); +} +