summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java50
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c32
2 files changed, 82 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index 8c2265e7..119a2df1 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -219,6 +219,56 @@ public class GuestFS {
throws LibGuestFSException;
/**
+ * set the qemu binary
+ *
+ * Set the qemu binary that we will use.
+ *
+ * The default is chosen when the library was compiled by
+ * the configure script.
+ *
+ * You can also override this by setting the
+ * "LIBGUESTFS_QEMU" environment variable.
+ *
+ * The string "qemu" is stashed in the libguestfs handle,
+ * so the caller must make sure it remains valid for the
+ * lifetime of the handle.
+ *
+ * Setting "qemu" to "NULL" restores the default qemu
+ * binary.
+ *
+ * @throws LibGuestFSException
+ */
+ public void set_qemu (String qemu)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("set_qemu: handle is closed");
+ _set_qemu (g, qemu);
+ }
+ private native void _set_qemu (long g, String qemu)
+ throws LibGuestFSException;
+
+ /**
+ * get the qemu binary
+ *
+ * Return the current qemu binary.
+ *
+ * This is always non-NULL. If it wasn't set already, then
+ * this will return the default qemu binary name.
+ *
+ * @throws LibGuestFSException
+ */
+ public String get_qemu ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("get_qemu: handle is closed");
+ return _get_qemu (g);
+ }
+ private native String _get_qemu (long g)
+ throws LibGuestFSException;
+
+ /**
* set the search path
*
* Set the path that libguestfs searches for kernel and
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index 51412780..550568b8 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -158,6 +158,38 @@ Java_com_redhat_et_libguestfs_GuestFS__1config
}
JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1set_1qemu
+ (JNIEnv *env, jobject obj, jlong jg, jstring jqemu)
+{
+ guestfs_h *g = (guestfs_h *) jg;
+ int r;
+ const char *qemu;
+
+ qemu = (*env)->GetStringUTFChars (env, jqemu, NULL);
+ r = guestfs_set_qemu (g, qemu);
+ (*env)->ReleaseStringUTFChars (env, jqemu, qemu);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+
+JNIEXPORT jstring JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1get_1qemu
+ (JNIEnv *env, jobject obj, jlong jg)
+{
+ guestfs_h *g = (guestfs_h *) jg;
+ const char *r;
+
+ r = guestfs_get_qemu (g);
+ if (r == NULL) {
+ throw_exception (env, guestfs_last_error (g));
+ return NULL;
+ }
+ return (*env)->NewStringUTF (env, r);
+}
+
+JNIEXPORT void JNICALL
Java_com_redhat_et_libguestfs_GuestFS__1set_1path
(JNIEnv *env, jobject obj, jlong jg, jstring jpath)
{