mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
Add generated code for 'fsck' command.
This commit is contained in:
@@ -2356,4 +2356,30 @@ public class GuestFS {
|
||||
private native String _get_e2uuid (long g, String device)
|
||||
throws LibGuestFSException;
|
||||
|
||||
/**
|
||||
* run the filesystem checker
|
||||
*
|
||||
* This runs the filesystem checker (fsck) on "device"
|
||||
* which should have filesystem type "fstype".
|
||||
*
|
||||
* The returned integer is the status. See fsck(8) for the
|
||||
* list of status codes from "fsck", and note that multiple
|
||||
* status codes can be summed together.
|
||||
*
|
||||
* It is entirely equivalent to running "fsck -a -t fstype
|
||||
* device". Note that checking or repairing NTFS volumes is
|
||||
* not supported (by linux-ntfs).
|
||||
*
|
||||
* @throws LibGuestFSException
|
||||
*/
|
||||
public int fsck (String fstype, String device)
|
||||
throws LibGuestFSException
|
||||
{
|
||||
if (g == 0)
|
||||
throw new LibGuestFSException ("fsck: handle is closed");
|
||||
return _fsck (g, fstype, device);
|
||||
}
|
||||
private native int _fsck (long g, String fstype, String device)
|
||||
throws LibGuestFSException;
|
||||
|
||||
}
|
||||
|
||||
@@ -2399,3 +2399,24 @@ Java_com_redhat_et_libguestfs_GuestFS__1get_1e2uuid
|
||||
return jr;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_redhat_et_libguestfs_GuestFS__1fsck
|
||||
(JNIEnv *env, jobject obj, jlong jg, jstring jfstype, jstring jdevice)
|
||||
{
|
||||
guestfs_h *g = (guestfs_h *) (long) jg;
|
||||
int r;
|
||||
const char *fstype;
|
||||
const char *device;
|
||||
|
||||
fstype = (*env)->GetStringUTFChars (env, jfstype, NULL);
|
||||
device = (*env)->GetStringUTFChars (env, jdevice, NULL);
|
||||
r = guestfs_fsck (g, fstype, device);
|
||||
(*env)->ReleaseStringUTFChars (env, jfstype, fstype);
|
||||
(*env)->ReleaseStringUTFChars (env, jdevice, device);
|
||||
if (r == -1) {
|
||||
throw_exception (env, guestfs_last_error (g));
|
||||
return 0;
|
||||
}
|
||||
return (jint) r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user