diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-23 15:53:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-23 15:53:44 +0100 |
commit | bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e (patch) | |
tree | 80042c722c65911c3a3b55a275daefff96220e7f /ocaml | |
parent | da7cf3670fe60301beeb175ff6c284b737d5b7f4 (diff) | |
download | libguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.tar.gz libguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.tar.xz libguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.zip |
Generated code for 'scrub-*' commands.
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 3 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 9 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 69 |
3 files changed, 81 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index fb83545b..f0c789ba 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -280,3 +280,6 @@ external ntfs_3g_probe : t -> bool -> string -> int = "ocaml_guestfs_ntfs_3g_pro external sh : t -> string -> string = "ocaml_guestfs_sh" external sh_lines : t -> string -> string array = "ocaml_guestfs_sh_lines" external glob_expand : t -> string -> string array = "ocaml_guestfs_glob_expand" +external scrub_device : t -> string -> unit = "ocaml_guestfs_scrub_device" +external scrub_file : t -> string -> unit = "ocaml_guestfs_scrub_file" +external scrub_freespace : t -> string -> unit = "ocaml_guestfs_scrub_freespace" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 345c7ec6..d93cfdc8 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -619,3 +619,12 @@ val sh_lines : t -> string -> string array val glob_expand : t -> string -> string array (** expand a wildcard path *) +val scrub_device : t -> string -> unit +(** scrub (securely wipe) a device *) + +val scrub_file : t -> string -> unit +(** scrub (securely wipe) a file *) + +val scrub_freespace : t -> string -> unit +(** scrub (securely wipe) free space *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 1ce55f0a..a8204e8a 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -4274,3 +4274,72 @@ ocaml_guestfs_glob_expand (value gv, value patternv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_scrub_device (value gv, value devicev) +{ + CAMLparam2 (gv, devicev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("scrub_device: used handle after closing it"); + + const char *device = String_val (devicev); + int r; + + caml_enter_blocking_section (); + r = guestfs_scrub_device (g, device); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "scrub_device"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_scrub_file (value gv, value filev) +{ + CAMLparam2 (gv, filev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("scrub_file: used handle after closing it"); + + const char *file = String_val (filev); + int r; + + caml_enter_blocking_section (); + r = guestfs_scrub_file (g, file); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "scrub_file"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_scrub_freespace (value gv, value dirv) +{ + CAMLparam2 (gv, dirv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("scrub_freespace: used handle after closing it"); + + const char *dir = String_val (dirv); + int r; + + caml_enter_blocking_section (); + r = guestfs_scrub_freespace (g, dir); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "scrub_freespace"); + + rv = Val_unit; + CAMLreturn (rv); +} + |