diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-05-01 12:16:08 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-05-01 12:16:08 +0100 |
commit | f47dafd23186938a22d41739d9bc695c7760b912 (patch) | |
tree | a6e5bf03a63cae2eeca269505724ae5c5ba11020 /ocaml | |
parent | d9ea3e8d979c3ade1b21f27083788fd33fa3b1fa (diff) | |
download | libguestfs-f47dafd23186938a22d41739d9bc695c7760b912.tar.gz libguestfs-f47dafd23186938a22d41739d9bc695c7760b912.tar.xz libguestfs-f47dafd23186938a22d41739d9bc695c7760b912.zip |
Generated code for 'equal' command.
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 | 24 |
3 files changed, 28 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index e4916b07..99d59037 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -228,3 +228,4 @@ external mv : t -> string -> string -> unit = "ocaml_guestfs_mv" external drop_caches : t -> int -> unit = "ocaml_guestfs_drop_caches" external dmesg : t -> string = "ocaml_guestfs_dmesg" external ping_daemon : t -> unit = "ocaml_guestfs_ping_daemon" +external equal : t -> string -> string -> bool = "ocaml_guestfs_equal" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 125fa979..40d1d2a4 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -463,3 +463,6 @@ val dmesg : t -> string val ping_daemon : t -> unit (** ping the guest daemon *) +val equal : t -> string -> string -> bool +(** test if two files have equal contents *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index a640e0f3..7732e1c6 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -3010,3 +3010,27 @@ ocaml_guestfs_ping_daemon (value gv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_equal (value gv, value file1v, value file2v) +{ + CAMLparam3 (gv, file1v, file2v); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("equal: used handle after closing it"); + + const char *file1 = String_val (file1v); + const char *file2 = String_val (file2v); + int r; + + caml_enter_blocking_section (); + r = guestfs_equal (g, file1, file2); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "equal"); + + rv = Val_bool (r); + CAMLreturn (rv); +} + |