diff options
| author | Richard W.M. Jones <rjones@redhat.com> | 2009-05-01 11:18:53 +0100 |
|---|---|---|
| committer | Richard W.M. Jones <rjones@redhat.com> | 2009-05-01 11:18:53 +0100 |
| commit | 9222136ac9b2e404dba128b1ac74dacaa8bf1038 (patch) | |
| tree | 84d74f0c966b925c3e22bf3322256df10455d94b /ocaml | |
| parent | 2dc9e8a858b62830d15a8186fe575eb7903d2171 (diff) | |
| download | libguestfs-9222136ac9b2e404dba128b1ac74dacaa8bf1038.tar.gz libguestfs-9222136ac9b2e404dba128b1ac74dacaa8bf1038.tar.xz libguestfs-9222136ac9b2e404dba128b1ac74dacaa8bf1038.zip | |
Generated code for drop-caches 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 | 23 |
3 files changed, 27 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index f196ea15..e79a076b 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -225,3 +225,4 @@ external grub_install : t -> string -> string -> unit = "ocaml_guestfs_grub_inst external cp : t -> string -> string -> unit = "ocaml_guestfs_cp" external cp_a : t -> string -> string -> unit = "ocaml_guestfs_cp_a" external mv : t -> string -> string -> unit = "ocaml_guestfs_mv" +external drop_caches : t -> int -> unit = "ocaml_guestfs_drop_caches" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 60ec056d..5baf9955 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -454,3 +454,6 @@ val cp_a : t -> string -> string -> unit val mv : t -> string -> string -> unit (** move a file *) +val drop_caches : t -> int -> unit +(** drop kernel page cache, dentries and inodes *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index f4c18088..d6d13053 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -2942,3 +2942,26 @@ ocaml_guestfs_mv (value gv, value srcv, value destv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_drop_caches (value gv, value whattodropv) +{ + CAMLparam2 (gv, whattodropv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("drop_caches: used handle after closing it"); + + int whattodrop = Int_val (whattodropv); + int r; + + caml_enter_blocking_section (); + r = guestfs_drop_caches (g, whattodrop); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "drop_caches"); + + rv = Val_unit; + CAMLreturn (rv); +} + |
