summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-23 15:53:44 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-23 15:53:44 +0100
commitbcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e (patch)
tree80042c722c65911c3a3b55a275daefff96220e7f /java
parentda7cf3670fe60301beeb175ff6c284b737d5b7f4 (diff)
downloadlibguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.tar.gz
libguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.tar.xz
libguestfs-bcb3fc0c3336c05e9ecbbfb25c7c31b42bd3e32e.zip
Generated code for 'scrub-*' commands.
Diffstat (limited to 'java')
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java75
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c51
2 files changed, 125 insertions, 1 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index cdc0f094..36689700 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -427,7 +427,7 @@ public HashMap<String,String> test0rhashtableerr ()
* to modify the image).
* <p>
* This is equivalent to the qemu parameter "-drive
- * file=filename".
+ * file=filename,cache=off".
* <p>
* Note that this call checks for the existence of
* "filename". This stops you from specifying other types
@@ -2801,6 +2801,8 @@ public HashMap<String,String> test0rhashtableerr ()
* sufficient to remove any partition tables, filesystem
* superblocks and so on.
* <p>
+ * See also: "g.scrub_device".
+ * <p>
* @throws LibGuestFSException
*/
public void zero (String device)
@@ -3461,4 +3463,75 @@ public HashMap<String,String> test0rhashtableerr ()
private native String[] _glob_expand (long g, String pattern)
throws LibGuestFSException;
+ /**
+ * scrub (securely wipe) a device
+ * <p>
+ * This command writes patterns over "device" to make data
+ * retrieval more difficult.
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * This command is dangerous. Without careful use you can
+ * easily destroy all your data.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_device (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_device: handle is closed");
+ _scrub_device (g, device);
+ }
+ private native void _scrub_device (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * scrub (securely wipe) a file
+ * <p>
+ * This command writes patterns over a file to make data
+ * retrieval more difficult.
+ * <p>
+ * The file is *removed* after scrubbing.
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_file (String file)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_file: handle is closed");
+ _scrub_file (g, file);
+ }
+ private native void _scrub_file (long g, String file)
+ throws LibGuestFSException;
+
+ /**
+ * scrub (securely wipe) free space
+ * <p>
+ * This command creates the directory "dir" and then fills
+ * it with files until the filesystem is full, and scrubs
+ * the files as for "g.scrub_file", and deletes them. The
+ * intention is to scrub any free space on the partition
+ * containing "dir".
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_freespace (String dir)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_freespace: handle is closed");
+ _scrub_freespace (g, dir);
+ }
+ private native void _scrub_freespace (long g, String dir)
+ throws LibGuestFSException;
+
}
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index 8a5afe93..37cd4c9a 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -4073,3 +4073,54 @@ Java_com_redhat_et_libguestfs_GuestFS__1glob_1expand
return jr;
}
+JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1scrub_1device
+ (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *device;
+
+ device = (*env)->GetStringUTFChars (env, jdevice, NULL);
+ r = guestfs_scrub_device (g, device);
+ (*env)->ReleaseStringUTFChars (env, jdevice, device);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1scrub_1file
+ (JNIEnv *env, jobject obj, jlong jg, jstring jfile)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *file;
+
+ file = (*env)->GetStringUTFChars (env, jfile, NULL);
+ r = guestfs_scrub_file (g, file);
+ (*env)->ReleaseStringUTFChars (env, jfile, file);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1scrub_1freespace
+ (JNIEnv *env, jobject obj, jlong jg, jstring jdir)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *dir;
+
+ dir = (*env)->GetStringUTFChars (env, jdir, NULL);
+ r = guestfs_scrub_freespace (g, dir);
+ (*env)->ReleaseStringUTFChars (env, jdir, dir);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+