Generated code for 'scrub-*' commands.

This commit is contained in:
Richard W.M. Jones
2009-06-23 15:53:44 +01:00
parent da7cf3670f
commit bcb3fc0c33
23 changed files with 1239 additions and 10 deletions

View File

@@ -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;
}

View File

@@ -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 ;
}
}