X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=java%2Fcom_redhat_et_libguestfs_GuestFS.c;h=da287b15ae7edaffc2c850ae5e1a7dac251c70ad;hb=db1aacb8e0ac28283e1d9f7d02119868de19836b;hp=466ced858ea55c66398fd06701f904f2f7a2e37a;hpb=62df226f26bd6ac3c481a7790eb89d760d2f0386;p=libguestfs.git diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c index 466ced8..da287b1 100644 --- a/java/com_redhat_et_libguestfs_GuestFS.c +++ b/java/com_redhat_et_libguestfs_GuestFS.c @@ -2437,3 +2437,152 @@ Java_com_redhat_et_libguestfs_GuestFS__1zero } } +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1grub_1install + (JNIEnv *env, jobject obj, jlong jg, jstring jroot, jstring jdevice) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + const char *root; + const char *device; + + root = (*env)->GetStringUTFChars (env, jroot, NULL); + device = (*env)->GetStringUTFChars (env, jdevice, NULL); + r = guestfs_grub_install (g, root, device); + (*env)->ReleaseStringUTFChars (env, jroot, root); + (*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__1cp + (JNIEnv *env, jobject obj, jlong jg, jstring jsrc, jstring jdest) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + const char *src; + const char *dest; + + src = (*env)->GetStringUTFChars (env, jsrc, NULL); + dest = (*env)->GetStringUTFChars (env, jdest, NULL); + r = guestfs_cp (g, src, dest); + (*env)->ReleaseStringUTFChars (env, jsrc, src); + (*env)->ReleaseStringUTFChars (env, jdest, dest); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1cp_1a + (JNIEnv *env, jobject obj, jlong jg, jstring jsrc, jstring jdest) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + const char *src; + const char *dest; + + src = (*env)->GetStringUTFChars (env, jsrc, NULL); + dest = (*env)->GetStringUTFChars (env, jdest, NULL); + r = guestfs_cp_a (g, src, dest); + (*env)->ReleaseStringUTFChars (env, jsrc, src); + (*env)->ReleaseStringUTFChars (env, jdest, dest); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mv + (JNIEnv *env, jobject obj, jlong jg, jstring jsrc, jstring jdest) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + const char *src; + const char *dest; + + src = (*env)->GetStringUTFChars (env, jsrc, NULL); + dest = (*env)->GetStringUTFChars (env, jdest, NULL); + r = guestfs_mv (g, src, dest); + (*env)->ReleaseStringUTFChars (env, jsrc, src); + (*env)->ReleaseStringUTFChars (env, jdest, dest); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1drop_1caches + (JNIEnv *env, jobject obj, jlong jg, jint jwhattodrop) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int whattodrop; + + whattodrop = jwhattodrop; + r = guestfs_drop_caches (g, whattodrop); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT jstring JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1dmesg + (JNIEnv *env, jobject obj, jlong jg) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + jstring jr; + char *r; + + r = guestfs_dmesg (g); + if (r == NULL) { + throw_exception (env, guestfs_last_error (g)); + return NULL; + } + jr = (*env)->NewStringUTF (env, r); + free (r); + return jr; +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1ping_1daemon + (JNIEnv *env, jobject obj, jlong jg) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + + r = guestfs_ping_daemon (g); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT jboolean JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1equal + (JNIEnv *env, jobject obj, jlong jg, jstring jfile1, jstring jfile2) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + const char *file1; + const char *file2; + + file1 = (*env)->GetStringUTFChars (env, jfile1, NULL); + file2 = (*env)->GetStringUTFChars (env, jfile2, NULL); + r = guestfs_equal (g, file1, file2); + (*env)->ReleaseStringUTFChars (env, jfile1, file1); + (*env)->ReleaseStringUTFChars (env, jfile2, file2); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return 0; + } + return (jboolean) r; +} +