diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-09 19:36:07 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-09 19:36:07 +0100 |
commit | 01c26253a12ed1e6b1199f8c85f049a7fc4aef28 (patch) | |
tree | 02a9f655430a8e7cf282b7dd9bf042640654f599 /ocaml | |
parent | 0677b12f2273ed266da9dd276c129342d6a939a2 (diff) | |
download | libguestfs-01c26253a12ed1e6b1199f8c85f049a7fc4aef28.tar.gz libguestfs-01c26253a12ed1e6b1199f8c85f049a7fc4aef28.tar.xz libguestfs-01c26253a12ed1e6b1199f8c85f049a7fc4aef28.zip |
Added aug-ls (generated code).
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 1 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 3 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 26 |
3 files changed, 30 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index 64878611..fba005f6 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -124,3 +124,4 @@ external aug_mv : t -> string -> string -> unit = "ocaml_guestfs_aug_mv" external aug_match : t -> string -> string array = "ocaml_guestfs_aug_match" external aug_save : t -> unit = "ocaml_guestfs_aug_save" external aug_load : t -> unit = "ocaml_guestfs_aug_load" +external aug_ls : t -> string -> string array = "ocaml_guestfs_aug_ls" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index b1452abe..4981eb1e 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -211,3 +211,6 @@ val aug_save : t -> unit val aug_load : t -> unit (** load files into the tree *) +val aug_ls : t -> string -> string array +(** list Augeas nodes under a path *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index f21d63ec..f26226c0 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); +} + |