1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "com_redhat_et_libguestfs_GuestFS.h"
29 /* Note that this function returns. The exception is not thrown
30 * until after the wrapper function returns.
33 throw_exception (JNIEnv *env, const char *msg)
36 cl = (*env)->FindClass (env,
37 "com/redhat/et/libguestfs/LibGuestFSException");
38 (*env)->ThrowNew (env, cl, msg);
41 JNIEXPORT jlong JNICALL
42 Java_com_redhat_et_libguestfs_GuestFS__1create
43 (JNIEnv *env, jobject obj)
47 g = guestfs_create ();
49 throw_exception (env, "GuestFS.create: failed to allocate handle");
52 guestfs_set_error_handler (g, NULL, NULL);
53 return (jlong) (long) g;
56 JNIEXPORT void JNICALL
57 Java_com_redhat_et_libguestfs_GuestFS__1close
58 (JNIEnv *env, jobject obj, jlong jg)
60 guestfs_h *g = (guestfs_h *) (long) jg;
64 JNIEXPORT void JNICALL
65 Java_com_redhat_et_libguestfs_GuestFS__1launch
66 (JNIEnv *env, jobject obj, jlong jg)
68 guestfs_h *g = (guestfs_h *) (long) jg;
71 r = guestfs_launch (g);
73 throw_exception (env, guestfs_last_error (g));
78 JNIEXPORT void JNICALL
79 Java_com_redhat_et_libguestfs_GuestFS__1wait_1ready
80 (JNIEnv *env, jobject obj, jlong jg)
82 guestfs_h *g = (guestfs_h *) (long) jg;
85 r = guestfs_wait_ready (g);
87 throw_exception (env, guestfs_last_error (g));
92 JNIEXPORT void JNICALL
93 Java_com_redhat_et_libguestfs_GuestFS__1kill_1subprocess
94 (JNIEnv *env, jobject obj, jlong jg)
96 guestfs_h *g = (guestfs_h *) (long) jg;
99 r = guestfs_kill_subprocess (g);
101 throw_exception (env, guestfs_last_error (g));
106 JNIEXPORT void JNICALL
107 Java_com_redhat_et_libguestfs_GuestFS__1add_1drive
108 (JNIEnv *env, jobject obj, jlong jg, jstring jfilename)
110 guestfs_h *g = (guestfs_h *) (long) jg;
112 const char *filename;
114 filename = (*env)->GetStringUTFChars (env, jfilename, NULL);
115 r = guestfs_add_drive (g, filename);
116 (*env)->ReleaseStringUTFChars (env, jfilename, filename);
118 throw_exception (env, guestfs_last_error (g));
123 JNIEXPORT void JNICALL
124 Java_com_redhat_et_libguestfs_GuestFS__1add_1cdrom
125 (JNIEnv *env, jobject obj, jlong jg, jstring jfilename)
127 guestfs_h *g = (guestfs_h *) (long) jg;
129 const char *filename;
131 filename = (*env)->GetStringUTFChars (env, jfilename, NULL);
132 r = guestfs_add_cdrom (g, filename);
133 (*env)->ReleaseStringUTFChars (env, jfilename, filename);
135 throw_exception (env, guestfs_last_error (g));
140 JNIEXPORT void JNICALL
141 Java_com_redhat_et_libguestfs_GuestFS__1config
142 (JNIEnv *env, jobject obj, jlong jg, jstring jqemuparam, jstring jqemuvalue)
144 guestfs_h *g = (guestfs_h *) (long) jg;
146 const char *qemuparam;
147 const char *qemuvalue;
149 qemuparam = (*env)->GetStringUTFChars (env, jqemuparam, NULL);
150 qemuvalue = (*env)->GetStringUTFChars (env, jqemuvalue, NULL);
151 r = guestfs_config (g, qemuparam, qemuvalue);
152 (*env)->ReleaseStringUTFChars (env, jqemuparam, qemuparam);
153 (*env)->ReleaseStringUTFChars (env, jqemuvalue, qemuvalue);
155 throw_exception (env, guestfs_last_error (g));
160 JNIEXPORT void JNICALL
161 Java_com_redhat_et_libguestfs_GuestFS__1set_1qemu
162 (JNIEnv *env, jobject obj, jlong jg, jstring jqemu)
164 guestfs_h *g = (guestfs_h *) (long) jg;
168 qemu = (*env)->GetStringUTFChars (env, jqemu, NULL);
169 r = guestfs_set_qemu (g, qemu);
170 (*env)->ReleaseStringUTFChars (env, jqemu, qemu);
172 throw_exception (env, guestfs_last_error (g));
177 JNIEXPORT jstring JNICALL
178 Java_com_redhat_et_libguestfs_GuestFS__1get_1qemu
179 (JNIEnv *env, jobject obj, jlong jg)
181 guestfs_h *g = (guestfs_h *) (long) jg;
184 r = guestfs_get_qemu (g);
186 throw_exception (env, guestfs_last_error (g));
189 return (*env)->NewStringUTF (env, r);
192 JNIEXPORT void JNICALL
193 Java_com_redhat_et_libguestfs_GuestFS__1set_1path
194 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
196 guestfs_h *g = (guestfs_h *) (long) jg;
200 path = (*env)->GetStringUTFChars (env, jpath, NULL);
201 r = guestfs_set_path (g, path);
202 (*env)->ReleaseStringUTFChars (env, jpath, path);
204 throw_exception (env, guestfs_last_error (g));
209 JNIEXPORT jstring JNICALL
210 Java_com_redhat_et_libguestfs_GuestFS__1get_1path
211 (JNIEnv *env, jobject obj, jlong jg)
213 guestfs_h *g = (guestfs_h *) (long) jg;
216 r = guestfs_get_path (g);
218 throw_exception (env, guestfs_last_error (g));
221 return (*env)->NewStringUTF (env, r);
224 JNIEXPORT void JNICALL
225 Java_com_redhat_et_libguestfs_GuestFS__1set_1autosync
226 (JNIEnv *env, jobject obj, jlong jg, jboolean jautosync)
228 guestfs_h *g = (guestfs_h *) (long) jg;
232 autosync = jautosync;
233 r = guestfs_set_autosync (g, autosync);
235 throw_exception (env, guestfs_last_error (g));
240 JNIEXPORT jboolean JNICALL
241 Java_com_redhat_et_libguestfs_GuestFS__1get_1autosync
242 (JNIEnv *env, jobject obj, jlong jg)
244 guestfs_h *g = (guestfs_h *) (long) jg;
247 r = guestfs_get_autosync (g);
249 throw_exception (env, guestfs_last_error (g));
255 JNIEXPORT void JNICALL
256 Java_com_redhat_et_libguestfs_GuestFS__1set_1verbose
257 (JNIEnv *env, jobject obj, jlong jg, jboolean jverbose)
259 guestfs_h *g = (guestfs_h *) (long) jg;
264 r = guestfs_set_verbose (g, verbose);
266 throw_exception (env, guestfs_last_error (g));
271 JNIEXPORT jboolean JNICALL
272 Java_com_redhat_et_libguestfs_GuestFS__1get_1verbose
273 (JNIEnv *env, jobject obj, jlong jg)
275 guestfs_h *g = (guestfs_h *) (long) jg;
278 r = guestfs_get_verbose (g);
280 throw_exception (env, guestfs_last_error (g));
286 JNIEXPORT jboolean JNICALL
287 Java_com_redhat_et_libguestfs_GuestFS__1is_1ready
288 (JNIEnv *env, jobject obj, jlong jg)
290 guestfs_h *g = (guestfs_h *) (long) jg;
293 r = guestfs_is_ready (g);
295 throw_exception (env, guestfs_last_error (g));
301 JNIEXPORT jboolean JNICALL
302 Java_com_redhat_et_libguestfs_GuestFS__1is_1config
303 (JNIEnv *env, jobject obj, jlong jg)
305 guestfs_h *g = (guestfs_h *) (long) jg;
308 r = guestfs_is_config (g);
310 throw_exception (env, guestfs_last_error (g));
316 JNIEXPORT jboolean JNICALL
317 Java_com_redhat_et_libguestfs_GuestFS__1is_1launching
318 (JNIEnv *env, jobject obj, jlong jg)
320 guestfs_h *g = (guestfs_h *) (long) jg;
323 r = guestfs_is_launching (g);
325 throw_exception (env, guestfs_last_error (g));
331 JNIEXPORT jboolean JNICALL
332 Java_com_redhat_et_libguestfs_GuestFS__1is_1busy
333 (JNIEnv *env, jobject obj, jlong jg)
335 guestfs_h *g = (guestfs_h *) (long) jg;
338 r = guestfs_is_busy (g);
340 throw_exception (env, guestfs_last_error (g));
346 JNIEXPORT jint JNICALL
347 Java_com_redhat_et_libguestfs_GuestFS__1get_1state
348 (JNIEnv *env, jobject obj, jlong jg)
350 guestfs_h *g = (guestfs_h *) (long) jg;
353 r = guestfs_get_state (g);
355 throw_exception (env, guestfs_last_error (g));
361 JNIEXPORT void JNICALL
362 Java_com_redhat_et_libguestfs_GuestFS__1set_1busy
363 (JNIEnv *env, jobject obj, jlong jg)
365 guestfs_h *g = (guestfs_h *) (long) jg;
368 r = guestfs_set_busy (g);
370 throw_exception (env, guestfs_last_error (g));
375 JNIEXPORT void JNICALL
376 Java_com_redhat_et_libguestfs_GuestFS__1set_1ready
377 (JNIEnv *env, jobject obj, jlong jg)
379 guestfs_h *g = (guestfs_h *) (long) jg;
382 r = guestfs_set_ready (g);
384 throw_exception (env, guestfs_last_error (g));
389 JNIEXPORT void JNICALL
390 Java_com_redhat_et_libguestfs_GuestFS__1mount
391 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jmountpoint)
393 guestfs_h *g = (guestfs_h *) (long) jg;
396 const char *mountpoint;
398 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
399 mountpoint = (*env)->GetStringUTFChars (env, jmountpoint, NULL);
400 r = guestfs_mount (g, device, mountpoint);
401 (*env)->ReleaseStringUTFChars (env, jdevice, device);
402 (*env)->ReleaseStringUTFChars (env, jmountpoint, mountpoint);
404 throw_exception (env, guestfs_last_error (g));
409 JNIEXPORT void JNICALL
410 Java_com_redhat_et_libguestfs_GuestFS__1sync
411 (JNIEnv *env, jobject obj, jlong jg)
413 guestfs_h *g = (guestfs_h *) (long) jg;
416 r = guestfs_sync (g);
418 throw_exception (env, guestfs_last_error (g));
423 JNIEXPORT void JNICALL
424 Java_com_redhat_et_libguestfs_GuestFS__1touch
425 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
427 guestfs_h *g = (guestfs_h *) (long) jg;
431 path = (*env)->GetStringUTFChars (env, jpath, NULL);
432 r = guestfs_touch (g, path);
433 (*env)->ReleaseStringUTFChars (env, jpath, path);
435 throw_exception (env, guestfs_last_error (g));
440 JNIEXPORT jstring JNICALL
441 Java_com_redhat_et_libguestfs_GuestFS__1cat
442 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
444 guestfs_h *g = (guestfs_h *) (long) jg;
449 path = (*env)->GetStringUTFChars (env, jpath, NULL);
450 r = guestfs_cat (g, path);
451 (*env)->ReleaseStringUTFChars (env, jpath, path);
453 throw_exception (env, guestfs_last_error (g));
456 jr = (*env)->NewStringUTF (env, r);
461 JNIEXPORT jstring JNICALL
462 Java_com_redhat_et_libguestfs_GuestFS__1ll
463 (JNIEnv *env, jobject obj, jlong jg, jstring jdirectory)
465 guestfs_h *g = (guestfs_h *) (long) jg;
468 const char *directory;
470 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
471 r = guestfs_ll (g, directory);
472 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
474 throw_exception (env, guestfs_last_error (g));
477 jr = (*env)->NewStringUTF (env, r);
482 JNIEXPORT jobjectArray JNICALL
483 Java_com_redhat_et_libguestfs_GuestFS__1ls
484 (JNIEnv *env, jobject obj, jlong jg, jstring jdirectory)
486 guestfs_h *g = (guestfs_h *) (long) jg;
492 const char *directory;
495 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
496 r = guestfs_ls (g, directory);
497 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
499 throw_exception (env, guestfs_last_error (g));
502 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
503 cl = (*env)->FindClass (env, "java/lang/String");
504 jstr = (*env)->NewStringUTF (env, "");
505 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
506 for (i = 0; i < r_len; ++i) {
507 jstr = (*env)->NewStringUTF (env, r[i]);
508 (*env)->SetObjectArrayElement (env, jr, i, jstr);
515 JNIEXPORT jobjectArray JNICALL
516 Java_com_redhat_et_libguestfs_GuestFS__1list_1devices
517 (JNIEnv *env, jobject obj, jlong jg)
519 guestfs_h *g = (guestfs_h *) (long) jg;
527 r = guestfs_list_devices (g);
529 throw_exception (env, guestfs_last_error (g));
532 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
533 cl = (*env)->FindClass (env, "java/lang/String");
534 jstr = (*env)->NewStringUTF (env, "");
535 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
536 for (i = 0; i < r_len; ++i) {
537 jstr = (*env)->NewStringUTF (env, r[i]);
538 (*env)->SetObjectArrayElement (env, jr, i, jstr);
545 JNIEXPORT jobjectArray JNICALL
546 Java_com_redhat_et_libguestfs_GuestFS__1list_1partitions
547 (JNIEnv *env, jobject obj, jlong jg)
549 guestfs_h *g = (guestfs_h *) (long) jg;
557 r = guestfs_list_partitions (g);
559 throw_exception (env, guestfs_last_error (g));
562 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
563 cl = (*env)->FindClass (env, "java/lang/String");
564 jstr = (*env)->NewStringUTF (env, "");
565 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
566 for (i = 0; i < r_len; ++i) {
567 jstr = (*env)->NewStringUTF (env, r[i]);
568 (*env)->SetObjectArrayElement (env, jr, i, jstr);
575 JNIEXPORT jobjectArray JNICALL
576 Java_com_redhat_et_libguestfs_GuestFS__1pvs
577 (JNIEnv *env, jobject obj, jlong jg)
579 guestfs_h *g = (guestfs_h *) (long) jg;
589 throw_exception (env, guestfs_last_error (g));
592 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
593 cl = (*env)->FindClass (env, "java/lang/String");
594 jstr = (*env)->NewStringUTF (env, "");
595 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
596 for (i = 0; i < r_len; ++i) {
597 jstr = (*env)->NewStringUTF (env, r[i]);
598 (*env)->SetObjectArrayElement (env, jr, i, jstr);
605 JNIEXPORT jobjectArray JNICALL
606 Java_com_redhat_et_libguestfs_GuestFS__1vgs
607 (JNIEnv *env, jobject obj, jlong jg)
609 guestfs_h *g = (guestfs_h *) (long) jg;
619 throw_exception (env, guestfs_last_error (g));
622 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
623 cl = (*env)->FindClass (env, "java/lang/String");
624 jstr = (*env)->NewStringUTF (env, "");
625 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
626 for (i = 0; i < r_len; ++i) {
627 jstr = (*env)->NewStringUTF (env, r[i]);
628 (*env)->SetObjectArrayElement (env, jr, i, jstr);
635 JNIEXPORT jobjectArray JNICALL
636 Java_com_redhat_et_libguestfs_GuestFS__1lvs
637 (JNIEnv *env, jobject obj, jlong jg)
639 guestfs_h *g = (guestfs_h *) (long) jg;
649 throw_exception (env, guestfs_last_error (g));
652 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
653 cl = (*env)->FindClass (env, "java/lang/String");
654 jstr = (*env)->NewStringUTF (env, "");
655 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
656 for (i = 0; i < r_len; ++i) {
657 jstr = (*env)->NewStringUTF (env, r[i]);
658 (*env)->SetObjectArrayElement (env, jr, i, jstr);
665 JNIEXPORT jobjectArray JNICALL
666 Java_com_redhat_et_libguestfs_GuestFS__1pvs_1full
667 (JNIEnv *env, jobject obj, jlong jg)
669 guestfs_h *g = (guestfs_h *) (long) jg;
674 struct guestfs_lvm_pv_list *r;
677 r = guestfs_pvs_full (g);
679 throw_exception (env, guestfs_last_error (g));
682 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/PV");
683 jr = (*env)->NewObjectArray (env, r->len, cl, NULL);
684 for (i = 0; i < r->len; ++i) {
685 jfl = (*env)->AllocObject (env, cl);
686 fl = (*env)->GetFieldID (env, cl, "pv_name", "Ljava/lang/String;");
687 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].pv_name));
690 memcpy (s, r->val[i].pv_uuid, 32);
692 fl = (*env)->GetFieldID (env, cl, "pv_uuid", "Ljava/lang/String;");
693 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, s));
695 fl = (*env)->GetFieldID (env, cl, "pv_fmt", "Ljava/lang/String;");
696 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].pv_fmt));
697 fl = (*env)->GetFieldID (env, cl, "pv_size", "J");
698 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_size);
699 fl = (*env)->GetFieldID (env, cl, "dev_size", "J");
700 (*env)->SetLongField (env, jfl, fl, r->val[i].dev_size);
701 fl = (*env)->GetFieldID (env, cl, "pv_free", "J");
702 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_free);
703 fl = (*env)->GetFieldID (env, cl, "pv_used", "J");
704 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_used);
705 fl = (*env)->GetFieldID (env, cl, "pv_attr", "Ljava/lang/String;");
706 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].pv_attr));
707 fl = (*env)->GetFieldID (env, cl, "pv_pe_count", "J");
708 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_pe_count);
709 fl = (*env)->GetFieldID (env, cl, "pv_pe_alloc_count", "J");
710 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_pe_alloc_count);
711 fl = (*env)->GetFieldID (env, cl, "pv_tags", "Ljava/lang/String;");
712 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].pv_tags));
713 fl = (*env)->GetFieldID (env, cl, "pe_start", "J");
714 (*env)->SetLongField (env, jfl, fl, r->val[i].pe_start);
715 fl = (*env)->GetFieldID (env, cl, "pv_mda_count", "J");
716 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_mda_count);
717 fl = (*env)->GetFieldID (env, cl, "pv_mda_free", "J");
718 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_mda_free);
719 (*env)->SetObjectArrayElement (env, jfl, i, jfl);
721 guestfs_free_lvm_pv_list (r);
725 JNIEXPORT jobjectArray JNICALL
726 Java_com_redhat_et_libguestfs_GuestFS__1vgs_1full
727 (JNIEnv *env, jobject obj, jlong jg)
729 guestfs_h *g = (guestfs_h *) (long) jg;
734 struct guestfs_lvm_vg_list *r;
737 r = guestfs_vgs_full (g);
739 throw_exception (env, guestfs_last_error (g));
742 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/VG");
743 jr = (*env)->NewObjectArray (env, r->len, cl, NULL);
744 for (i = 0; i < r->len; ++i) {
745 jfl = (*env)->AllocObject (env, cl);
746 fl = (*env)->GetFieldID (env, cl, "vg_name", "Ljava/lang/String;");
747 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].vg_name));
750 memcpy (s, r->val[i].vg_uuid, 32);
752 fl = (*env)->GetFieldID (env, cl, "vg_uuid", "Ljava/lang/String;");
753 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, s));
755 fl = (*env)->GetFieldID (env, cl, "vg_fmt", "Ljava/lang/String;");
756 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].vg_fmt));
757 fl = (*env)->GetFieldID (env, cl, "vg_attr", "Ljava/lang/String;");
758 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].vg_attr));
759 fl = (*env)->GetFieldID (env, cl, "vg_size", "J");
760 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_size);
761 fl = (*env)->GetFieldID (env, cl, "vg_free", "J");
762 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_free);
763 fl = (*env)->GetFieldID (env, cl, "vg_sysid", "Ljava/lang/String;");
764 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].vg_sysid));
765 fl = (*env)->GetFieldID (env, cl, "vg_extent_size", "J");
766 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_extent_size);
767 fl = (*env)->GetFieldID (env, cl, "vg_extent_count", "J");
768 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_extent_count);
769 fl = (*env)->GetFieldID (env, cl, "vg_free_count", "J");
770 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_free_count);
771 fl = (*env)->GetFieldID (env, cl, "max_lv", "J");
772 (*env)->SetLongField (env, jfl, fl, r->val[i].max_lv);
773 fl = (*env)->GetFieldID (env, cl, "max_pv", "J");
774 (*env)->SetLongField (env, jfl, fl, r->val[i].max_pv);
775 fl = (*env)->GetFieldID (env, cl, "pv_count", "J");
776 (*env)->SetLongField (env, jfl, fl, r->val[i].pv_count);
777 fl = (*env)->GetFieldID (env, cl, "lv_count", "J");
778 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_count);
779 fl = (*env)->GetFieldID (env, cl, "snap_count", "J");
780 (*env)->SetLongField (env, jfl, fl, r->val[i].snap_count);
781 fl = (*env)->GetFieldID (env, cl, "vg_seqno", "J");
782 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_seqno);
783 fl = (*env)->GetFieldID (env, cl, "vg_tags", "Ljava/lang/String;");
784 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].vg_tags));
785 fl = (*env)->GetFieldID (env, cl, "vg_mda_count", "J");
786 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_mda_count);
787 fl = (*env)->GetFieldID (env, cl, "vg_mda_free", "J");
788 (*env)->SetLongField (env, jfl, fl, r->val[i].vg_mda_free);
789 (*env)->SetObjectArrayElement (env, jfl, i, jfl);
791 guestfs_free_lvm_vg_list (r);
795 JNIEXPORT jobjectArray JNICALL
796 Java_com_redhat_et_libguestfs_GuestFS__1lvs_1full
797 (JNIEnv *env, jobject obj, jlong jg)
799 guestfs_h *g = (guestfs_h *) (long) jg;
804 struct guestfs_lvm_lv_list *r;
807 r = guestfs_lvs_full (g);
809 throw_exception (env, guestfs_last_error (g));
812 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/LV");
813 jr = (*env)->NewObjectArray (env, r->len, cl, NULL);
814 for (i = 0; i < r->len; ++i) {
815 jfl = (*env)->AllocObject (env, cl);
816 fl = (*env)->GetFieldID (env, cl, "lv_name", "Ljava/lang/String;");
817 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].lv_name));
820 memcpy (s, r->val[i].lv_uuid, 32);
822 fl = (*env)->GetFieldID (env, cl, "lv_uuid", "Ljava/lang/String;");
823 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, s));
825 fl = (*env)->GetFieldID (env, cl, "lv_attr", "Ljava/lang/String;");
826 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].lv_attr));
827 fl = (*env)->GetFieldID (env, cl, "lv_major", "J");
828 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_major);
829 fl = (*env)->GetFieldID (env, cl, "lv_minor", "J");
830 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_minor);
831 fl = (*env)->GetFieldID (env, cl, "lv_kernel_major", "J");
832 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_kernel_major);
833 fl = (*env)->GetFieldID (env, cl, "lv_kernel_minor", "J");
834 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_kernel_minor);
835 fl = (*env)->GetFieldID (env, cl, "lv_size", "J");
836 (*env)->SetLongField (env, jfl, fl, r->val[i].lv_size);
837 fl = (*env)->GetFieldID (env, cl, "seg_count", "J");
838 (*env)->SetLongField (env, jfl, fl, r->val[i].seg_count);
839 fl = (*env)->GetFieldID (env, cl, "origin", "Ljava/lang/String;");
840 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].origin));
841 fl = (*env)->GetFieldID (env, cl, "snap_percent", "F");
842 (*env)->SetFloatField (env, jfl, fl, r->val[i].snap_percent);
843 fl = (*env)->GetFieldID (env, cl, "copy_percent", "F");
844 (*env)->SetFloatField (env, jfl, fl, r->val[i].copy_percent);
845 fl = (*env)->GetFieldID (env, cl, "move_pv", "Ljava/lang/String;");
846 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].move_pv));
847 fl = (*env)->GetFieldID (env, cl, "lv_tags", "Ljava/lang/String;");
848 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].lv_tags));
849 fl = (*env)->GetFieldID (env, cl, "mirror_log", "Ljava/lang/String;");
850 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].mirror_log));
851 fl = (*env)->GetFieldID (env, cl, "modules", "Ljava/lang/String;");
852 (*env)->SetObjectField (env, jfl, fl, (*env)->NewStringUTF (env, r->val[i].modules));
853 (*env)->SetObjectArrayElement (env, jfl, i, jfl);
855 guestfs_free_lvm_lv_list (r);
859 JNIEXPORT jobjectArray JNICALL
860 Java_com_redhat_et_libguestfs_GuestFS__1read_1lines
861 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
863 guestfs_h *g = (guestfs_h *) (long) jg;
872 path = (*env)->GetStringUTFChars (env, jpath, NULL);
873 r = guestfs_read_lines (g, path);
874 (*env)->ReleaseStringUTFChars (env, jpath, path);
876 throw_exception (env, guestfs_last_error (g));
879 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
880 cl = (*env)->FindClass (env, "java/lang/String");
881 jstr = (*env)->NewStringUTF (env, "");
882 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
883 for (i = 0; i < r_len; ++i) {
884 jstr = (*env)->NewStringUTF (env, r[i]);
885 (*env)->SetObjectArrayElement (env, jr, i, jstr);
892 JNIEXPORT void JNICALL
893 Java_com_redhat_et_libguestfs_GuestFS__1aug_1init
894 (JNIEnv *env, jobject obj, jlong jg, jstring jroot, jint jflags)
896 guestfs_h *g = (guestfs_h *) (long) jg;
901 root = (*env)->GetStringUTFChars (env, jroot, NULL);
903 r = guestfs_aug_init (g, root, flags);
904 (*env)->ReleaseStringUTFChars (env, jroot, root);
906 throw_exception (env, guestfs_last_error (g));
911 JNIEXPORT void JNICALL
912 Java_com_redhat_et_libguestfs_GuestFS__1aug_1close
913 (JNIEnv *env, jobject obj, jlong jg)
915 guestfs_h *g = (guestfs_h *) (long) jg;
918 r = guestfs_aug_close (g);
920 throw_exception (env, guestfs_last_error (g));
925 JNIEXPORT jint JNICALL
926 Java_com_redhat_et_libguestfs_GuestFS__1aug_1defvar
927 (JNIEnv *env, jobject obj, jlong jg, jstring jname, jstring jexpr)
929 guestfs_h *g = (guestfs_h *) (long) jg;
934 name = (*env)->GetStringUTFChars (env, jname, NULL);
935 expr = (*env)->GetStringUTFChars (env, jexpr, NULL);
936 r = guestfs_aug_defvar (g, name, expr);
937 (*env)->ReleaseStringUTFChars (env, jname, name);
938 (*env)->ReleaseStringUTFChars (env, jexpr, expr);
940 throw_exception (env, guestfs_last_error (g));
946 JNIEXPORT jobject JNICALL
947 Java_com_redhat_et_libguestfs_GuestFS__1aug_1defnode
948 (JNIEnv *env, jobject obj, jlong jg, jstring jname, jstring jexpr, jstring jval)
950 guestfs_h *g = (guestfs_h *) (long) jg;
954 struct guestfs_int_bool *r;
959 name = (*env)->GetStringUTFChars (env, jname, NULL);
960 expr = (*env)->GetStringUTFChars (env, jexpr, NULL);
961 val = (*env)->GetStringUTFChars (env, jval, NULL);
962 r = guestfs_aug_defnode (g, name, expr, val);
963 (*env)->ReleaseStringUTFChars (env, jname, name);
964 (*env)->ReleaseStringUTFChars (env, jexpr, expr);
965 (*env)->ReleaseStringUTFChars (env, jval, val);
967 throw_exception (env, guestfs_last_error (g));
970 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/IntBool");
971 jr = (*env)->AllocObject (env, cl);
972 fl = (*env)->GetFieldID (env, cl, "i", "I");
973 (*env)->SetIntField (env, jr, fl, r->i);
974 fl = (*env)->GetFieldID (env, cl, "i", "Z");
975 (*env)->SetBooleanField (env, jr, fl, r->b);
976 guestfs_free_int_bool (r);
980 JNIEXPORT jstring JNICALL
981 Java_com_redhat_et_libguestfs_GuestFS__1aug_1get
982 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
984 guestfs_h *g = (guestfs_h *) (long) jg;
989 path = (*env)->GetStringUTFChars (env, jpath, NULL);
990 r = guestfs_aug_get (g, path);
991 (*env)->ReleaseStringUTFChars (env, jpath, path);
993 throw_exception (env, guestfs_last_error (g));
996 jr = (*env)->NewStringUTF (env, r);
1001 JNIEXPORT void JNICALL
1002 Java_com_redhat_et_libguestfs_GuestFS__1aug_1set
1003 (JNIEnv *env, jobject obj, jlong jg, jstring jpath, jstring jval)
1005 guestfs_h *g = (guestfs_h *) (long) jg;
1010 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1011 val = (*env)->GetStringUTFChars (env, jval, NULL);
1012 r = guestfs_aug_set (g, path, val);
1013 (*env)->ReleaseStringUTFChars (env, jpath, path);
1014 (*env)->ReleaseStringUTFChars (env, jval, val);
1016 throw_exception (env, guestfs_last_error (g));
1021 JNIEXPORT void JNICALL
1022 Java_com_redhat_et_libguestfs_GuestFS__1aug_1insert
1023 (JNIEnv *env, jobject obj, jlong jg, jstring jpath, jstring jlabel, jboolean jbefore)
1025 guestfs_h *g = (guestfs_h *) (long) jg;
1031 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1032 label = (*env)->GetStringUTFChars (env, jlabel, NULL);
1034 r = guestfs_aug_insert (g, path, label, before);
1035 (*env)->ReleaseStringUTFChars (env, jpath, path);
1036 (*env)->ReleaseStringUTFChars (env, jlabel, label);
1038 throw_exception (env, guestfs_last_error (g));
1043 JNIEXPORT jint JNICALL
1044 Java_com_redhat_et_libguestfs_GuestFS__1aug_1rm
1045 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1047 guestfs_h *g = (guestfs_h *) (long) jg;
1051 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1052 r = guestfs_aug_rm (g, path);
1053 (*env)->ReleaseStringUTFChars (env, jpath, path);
1055 throw_exception (env, guestfs_last_error (g));
1061 JNIEXPORT void JNICALL
1062 Java_com_redhat_et_libguestfs_GuestFS__1aug_1mv
1063 (JNIEnv *env, jobject obj, jlong jg, jstring jsrc, jstring jdest)
1065 guestfs_h *g = (guestfs_h *) (long) jg;
1070 src = (*env)->GetStringUTFChars (env, jsrc, NULL);
1071 dest = (*env)->GetStringUTFChars (env, jdest, NULL);
1072 r = guestfs_aug_mv (g, src, dest);
1073 (*env)->ReleaseStringUTFChars (env, jsrc, src);
1074 (*env)->ReleaseStringUTFChars (env, jdest, dest);
1076 throw_exception (env, guestfs_last_error (g));
1081 JNIEXPORT jobjectArray JNICALL
1082 Java_com_redhat_et_libguestfs_GuestFS__1aug_1match
1083 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1085 guestfs_h *g = (guestfs_h *) (long) jg;
1094 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1095 r = guestfs_aug_match (g, path);
1096 (*env)->ReleaseStringUTFChars (env, jpath, path);
1098 throw_exception (env, guestfs_last_error (g));
1101 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
1102 cl = (*env)->FindClass (env, "java/lang/String");
1103 jstr = (*env)->NewStringUTF (env, "");
1104 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
1105 for (i = 0; i < r_len; ++i) {
1106 jstr = (*env)->NewStringUTF (env, r[i]);
1107 (*env)->SetObjectArrayElement (env, jr, i, jstr);
1114 JNIEXPORT void JNICALL
1115 Java_com_redhat_et_libguestfs_GuestFS__1aug_1save
1116 (JNIEnv *env, jobject obj, jlong jg)
1118 guestfs_h *g = (guestfs_h *) (long) jg;
1121 r = guestfs_aug_save (g);
1123 throw_exception (env, guestfs_last_error (g));
1128 JNIEXPORT void JNICALL
1129 Java_com_redhat_et_libguestfs_GuestFS__1aug_1load
1130 (JNIEnv *env, jobject obj, jlong jg)
1132 guestfs_h *g = (guestfs_h *) (long) jg;
1135 r = guestfs_aug_load (g);
1137 throw_exception (env, guestfs_last_error (g));
1142 JNIEXPORT jobjectArray JNICALL
1143 Java_com_redhat_et_libguestfs_GuestFS__1aug_1ls
1144 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1146 guestfs_h *g = (guestfs_h *) (long) jg;
1155 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1156 r = guestfs_aug_ls (g, path);
1157 (*env)->ReleaseStringUTFChars (env, jpath, path);
1159 throw_exception (env, guestfs_last_error (g));
1162 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
1163 cl = (*env)->FindClass (env, "java/lang/String");
1164 jstr = (*env)->NewStringUTF (env, "");
1165 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
1166 for (i = 0; i < r_len; ++i) {
1167 jstr = (*env)->NewStringUTF (env, r[i]);
1168 (*env)->SetObjectArrayElement (env, jr, i, jstr);
1175 JNIEXPORT void JNICALL
1176 Java_com_redhat_et_libguestfs_GuestFS__1rm
1177 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1179 guestfs_h *g = (guestfs_h *) (long) jg;
1183 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1184 r = guestfs_rm (g, path);
1185 (*env)->ReleaseStringUTFChars (env, jpath, path);
1187 throw_exception (env, guestfs_last_error (g));
1192 JNIEXPORT void JNICALL
1193 Java_com_redhat_et_libguestfs_GuestFS__1rmdir
1194 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1196 guestfs_h *g = (guestfs_h *) (long) jg;
1200 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1201 r = guestfs_rmdir (g, path);
1202 (*env)->ReleaseStringUTFChars (env, jpath, path);
1204 throw_exception (env, guestfs_last_error (g));
1209 JNIEXPORT void JNICALL
1210 Java_com_redhat_et_libguestfs_GuestFS__1rm_1rf
1211 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1213 guestfs_h *g = (guestfs_h *) (long) jg;
1217 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1218 r = guestfs_rm_rf (g, path);
1219 (*env)->ReleaseStringUTFChars (env, jpath, path);
1221 throw_exception (env, guestfs_last_error (g));
1226 JNIEXPORT void JNICALL
1227 Java_com_redhat_et_libguestfs_GuestFS__1mkdir
1228 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1230 guestfs_h *g = (guestfs_h *) (long) jg;
1234 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1235 r = guestfs_mkdir (g, path);
1236 (*env)->ReleaseStringUTFChars (env, jpath, path);
1238 throw_exception (env, guestfs_last_error (g));
1243 JNIEXPORT void JNICALL
1244 Java_com_redhat_et_libguestfs_GuestFS__1mkdir_1p
1245 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1247 guestfs_h *g = (guestfs_h *) (long) jg;
1251 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1252 r = guestfs_mkdir_p (g, path);
1253 (*env)->ReleaseStringUTFChars (env, jpath, path);
1255 throw_exception (env, guestfs_last_error (g));
1260 JNIEXPORT void JNICALL
1261 Java_com_redhat_et_libguestfs_GuestFS__1chmod
1262 (JNIEnv *env, jobject obj, jlong jg, jint jmode, jstring jpath)
1264 guestfs_h *g = (guestfs_h *) (long) jg;
1270 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1271 r = guestfs_chmod (g, mode, path);
1272 (*env)->ReleaseStringUTFChars (env, jpath, path);
1274 throw_exception (env, guestfs_last_error (g));
1279 JNIEXPORT void JNICALL
1280 Java_com_redhat_et_libguestfs_GuestFS__1chown
1281 (JNIEnv *env, jobject obj, jlong jg, jint jowner, jint jgroup, jstring jpath)
1283 guestfs_h *g = (guestfs_h *) (long) jg;
1291 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1292 r = guestfs_chown (g, owner, group, path);
1293 (*env)->ReleaseStringUTFChars (env, jpath, path);
1295 throw_exception (env, guestfs_last_error (g));
1300 JNIEXPORT jboolean JNICALL
1301 Java_com_redhat_et_libguestfs_GuestFS__1exists
1302 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1304 guestfs_h *g = (guestfs_h *) (long) jg;
1308 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1309 r = guestfs_exists (g, path);
1310 (*env)->ReleaseStringUTFChars (env, jpath, path);
1312 throw_exception (env, guestfs_last_error (g));
1315 return (jboolean) r;
1318 JNIEXPORT jboolean JNICALL
1319 Java_com_redhat_et_libguestfs_GuestFS__1is_1file
1320 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1322 guestfs_h *g = (guestfs_h *) (long) jg;
1326 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1327 r = guestfs_is_file (g, path);
1328 (*env)->ReleaseStringUTFChars (env, jpath, path);
1330 throw_exception (env, guestfs_last_error (g));
1333 return (jboolean) r;
1336 JNIEXPORT jboolean JNICALL
1337 Java_com_redhat_et_libguestfs_GuestFS__1is_1dir
1338 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1340 guestfs_h *g = (guestfs_h *) (long) jg;
1344 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1345 r = guestfs_is_dir (g, path);
1346 (*env)->ReleaseStringUTFChars (env, jpath, path);
1348 throw_exception (env, guestfs_last_error (g));
1351 return (jboolean) r;
1354 JNIEXPORT void JNICALL
1355 Java_com_redhat_et_libguestfs_GuestFS__1pvcreate
1356 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1358 guestfs_h *g = (guestfs_h *) (long) jg;
1362 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1363 r = guestfs_pvcreate (g, device);
1364 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1366 throw_exception (env, guestfs_last_error (g));
1371 JNIEXPORT void JNICALL
1372 Java_com_redhat_et_libguestfs_GuestFS__1vgcreate
1373 (JNIEnv *env, jobject obj, jlong jg, jstring jvolgroup, jobjectArray jphysvols)
1375 guestfs_h *g = (guestfs_h *) (long) jg;
1377 const char *volgroup;
1379 const char **physvols;
1382 volgroup = (*env)->GetStringUTFChars (env, jvolgroup, NULL);
1383 physvols_len = (*env)->GetArrayLength (env, jphysvols);
1384 physvols = guestfs_safe_malloc (g, sizeof (char *) * (physvols_len+1));
1385 for (i = 0; i < physvols_len; ++i) {
1386 jobject o = (*env)->GetObjectArrayElement (env, jphysvols, i);
1387 physvols[i] = (*env)->GetStringUTFChars (env, o, NULL);
1389 physvols[physvols_len] = NULL;
1390 r = guestfs_vgcreate (g, volgroup, physvols);
1391 (*env)->ReleaseStringUTFChars (env, jvolgroup, volgroup);
1392 for (i = 0; i < physvols_len; ++i) {
1393 jobject o = (*env)->GetObjectArrayElement (env, jphysvols, i);
1394 (*env)->ReleaseStringUTFChars (env, o, physvols[i]);
1398 throw_exception (env, guestfs_last_error (g));
1403 JNIEXPORT void JNICALL
1404 Java_com_redhat_et_libguestfs_GuestFS__1lvcreate
1405 (JNIEnv *env, jobject obj, jlong jg, jstring jlogvol, jstring jvolgroup, jint jmbytes)
1407 guestfs_h *g = (guestfs_h *) (long) jg;
1410 const char *volgroup;
1413 logvol = (*env)->GetStringUTFChars (env, jlogvol, NULL);
1414 volgroup = (*env)->GetStringUTFChars (env, jvolgroup, NULL);
1416 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1417 (*env)->ReleaseStringUTFChars (env, jlogvol, logvol);
1418 (*env)->ReleaseStringUTFChars (env, jvolgroup, volgroup);
1420 throw_exception (env, guestfs_last_error (g));
1425 JNIEXPORT void JNICALL
1426 Java_com_redhat_et_libguestfs_GuestFS__1mkfs
1427 (JNIEnv *env, jobject obj, jlong jg, jstring jfstype, jstring jdevice)
1429 guestfs_h *g = (guestfs_h *) (long) jg;
1434 fstype = (*env)->GetStringUTFChars (env, jfstype, NULL);
1435 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1436 r = guestfs_mkfs (g, fstype, device);
1437 (*env)->ReleaseStringUTFChars (env, jfstype, fstype);
1438 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1440 throw_exception (env, guestfs_last_error (g));
1445 JNIEXPORT void JNICALL
1446 Java_com_redhat_et_libguestfs_GuestFS__1sfdisk
1447 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jint jcyls, jint jheads, jint jsectors, jobjectArray jlines)
1449 guestfs_h *g = (guestfs_h *) (long) jg;
1459 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1463 lines_len = (*env)->GetArrayLength (env, jlines);
1464 lines = guestfs_safe_malloc (g, sizeof (char *) * (lines_len+1));
1465 for (i = 0; i < lines_len; ++i) {
1466 jobject o = (*env)->GetObjectArrayElement (env, jlines, i);
1467 lines[i] = (*env)->GetStringUTFChars (env, o, NULL);
1469 lines[lines_len] = NULL;
1470 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1471 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1472 for (i = 0; i < lines_len; ++i) {
1473 jobject o = (*env)->GetObjectArrayElement (env, jlines, i);
1474 (*env)->ReleaseStringUTFChars (env, o, lines[i]);
1478 throw_exception (env, guestfs_last_error (g));
1483 JNIEXPORT void JNICALL
1484 Java_com_redhat_et_libguestfs_GuestFS__1write_1file
1485 (JNIEnv *env, jobject obj, jlong jg, jstring jpath, jstring jcontent, jint jsize)
1487 guestfs_h *g = (guestfs_h *) (long) jg;
1490 const char *content;
1493 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1494 content = (*env)->GetStringUTFChars (env, jcontent, NULL);
1496 r = guestfs_write_file (g, path, content, size);
1497 (*env)->ReleaseStringUTFChars (env, jpath, path);
1498 (*env)->ReleaseStringUTFChars (env, jcontent, content);
1500 throw_exception (env, guestfs_last_error (g));
1505 JNIEXPORT void JNICALL
1506 Java_com_redhat_et_libguestfs_GuestFS__1umount
1507 (JNIEnv *env, jobject obj, jlong jg, jstring jpathordevice)
1509 guestfs_h *g = (guestfs_h *) (long) jg;
1511 const char *pathordevice;
1513 pathordevice = (*env)->GetStringUTFChars (env, jpathordevice, NULL);
1514 r = guestfs_umount (g, pathordevice);
1515 (*env)->ReleaseStringUTFChars (env, jpathordevice, pathordevice);
1517 throw_exception (env, guestfs_last_error (g));
1522 JNIEXPORT jobjectArray JNICALL
1523 Java_com_redhat_et_libguestfs_GuestFS__1mounts
1524 (JNIEnv *env, jobject obj, jlong jg)
1526 guestfs_h *g = (guestfs_h *) (long) jg;
1534 r = guestfs_mounts (g);
1536 throw_exception (env, guestfs_last_error (g));
1539 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
1540 cl = (*env)->FindClass (env, "java/lang/String");
1541 jstr = (*env)->NewStringUTF (env, "");
1542 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
1543 for (i = 0; i < r_len; ++i) {
1544 jstr = (*env)->NewStringUTF (env, r[i]);
1545 (*env)->SetObjectArrayElement (env, jr, i, jstr);
1552 JNIEXPORT void JNICALL
1553 Java_com_redhat_et_libguestfs_GuestFS__1umount_1all
1554 (JNIEnv *env, jobject obj, jlong jg)
1556 guestfs_h *g = (guestfs_h *) (long) jg;
1559 r = guestfs_umount_all (g);
1561 throw_exception (env, guestfs_last_error (g));
1566 JNIEXPORT void JNICALL
1567 Java_com_redhat_et_libguestfs_GuestFS__1lvm_1remove_1all
1568 (JNIEnv *env, jobject obj, jlong jg)
1570 guestfs_h *g = (guestfs_h *) (long) jg;
1573 r = guestfs_lvm_remove_all (g);
1575 throw_exception (env, guestfs_last_error (g));
1580 JNIEXPORT jstring JNICALL
1581 Java_com_redhat_et_libguestfs_GuestFS__1file
1582 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1584 guestfs_h *g = (guestfs_h *) (long) jg;
1589 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1590 r = guestfs_file (g, path);
1591 (*env)->ReleaseStringUTFChars (env, jpath, path);
1593 throw_exception (env, guestfs_last_error (g));
1596 jr = (*env)->NewStringUTF (env, r);
1601 JNIEXPORT jstring JNICALL
1602 Java_com_redhat_et_libguestfs_GuestFS__1command
1603 (JNIEnv *env, jobject obj, jlong jg, jobjectArray jarguments)
1605 guestfs_h *g = (guestfs_h *) (long) jg;
1609 const char **arguments;
1612 arguments_len = (*env)->GetArrayLength (env, jarguments);
1613 arguments = guestfs_safe_malloc (g, sizeof (char *) * (arguments_len+1));
1614 for (i = 0; i < arguments_len; ++i) {
1615 jobject o = (*env)->GetObjectArrayElement (env, jarguments, i);
1616 arguments[i] = (*env)->GetStringUTFChars (env, o, NULL);
1618 arguments[arguments_len] = NULL;
1619 r = guestfs_command (g, arguments);
1620 for (i = 0; i < arguments_len; ++i) {
1621 jobject o = (*env)->GetObjectArrayElement (env, jarguments, i);
1622 (*env)->ReleaseStringUTFChars (env, o, arguments[i]);
1626 throw_exception (env, guestfs_last_error (g));
1629 jr = (*env)->NewStringUTF (env, r);
1634 JNIEXPORT jobjectArray JNICALL
1635 Java_com_redhat_et_libguestfs_GuestFS__1command_1lines
1636 (JNIEnv *env, jobject obj, jlong jg, jobjectArray jarguments)
1638 guestfs_h *g = (guestfs_h *) (long) jg;
1645 const char **arguments;
1648 arguments_len = (*env)->GetArrayLength (env, jarguments);
1649 arguments = guestfs_safe_malloc (g, sizeof (char *) * (arguments_len+1));
1650 for (i = 0; i < arguments_len; ++i) {
1651 jobject o = (*env)->GetObjectArrayElement (env, jarguments, i);
1652 arguments[i] = (*env)->GetStringUTFChars (env, o, NULL);
1654 arguments[arguments_len] = NULL;
1655 r = guestfs_command_lines (g, arguments);
1656 for (i = 0; i < arguments_len; ++i) {
1657 jobject o = (*env)->GetObjectArrayElement (env, jarguments, i);
1658 (*env)->ReleaseStringUTFChars (env, o, arguments[i]);
1662 throw_exception (env, guestfs_last_error (g));
1665 for (r_len = 0; r[r_len] != NULL; ++r_len) ;
1666 cl = (*env)->FindClass (env, "java/lang/String");
1667 jstr = (*env)->NewStringUTF (env, "");
1668 jr = (*env)->NewObjectArray (env, r_len, cl, jstr);
1669 for (i = 0; i < r_len; ++i) {
1670 jstr = (*env)->NewStringUTF (env, r[i]);
1671 (*env)->SetObjectArrayElement (env, jr, i, jstr);
1678 JNIEXPORT jobject JNICALL
1679 Java_com_redhat_et_libguestfs_GuestFS__1stat
1680 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1682 guestfs_h *g = (guestfs_h *) (long) jg;
1686 struct guestfs_stat *r;
1689 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1690 r = guestfs_stat (g, path);
1691 (*env)->ReleaseStringUTFChars (env, jpath, path);
1693 throw_exception (env, guestfs_last_error (g));
1696 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/Stat");
1697 jr = (*env)->AllocObject (env, cl);
1698 fl = (*env)->GetFieldID (env, cl, "dev", "J");
1699 (*env)->SetLongField (env, jr, fl, r->dev);
1700 fl = (*env)->GetFieldID (env, cl, "ino", "J");
1701 (*env)->SetLongField (env, jr, fl, r->ino);
1702 fl = (*env)->GetFieldID (env, cl, "mode", "J");
1703 (*env)->SetLongField (env, jr, fl, r->mode);
1704 fl = (*env)->GetFieldID (env, cl, "nlink", "J");
1705 (*env)->SetLongField (env, jr, fl, r->nlink);
1706 fl = (*env)->GetFieldID (env, cl, "uid", "J");
1707 (*env)->SetLongField (env, jr, fl, r->uid);
1708 fl = (*env)->GetFieldID (env, cl, "gid", "J");
1709 (*env)->SetLongField (env, jr, fl, r->gid);
1710 fl = (*env)->GetFieldID (env, cl, "rdev", "J");
1711 (*env)->SetLongField (env, jr, fl, r->rdev);
1712 fl = (*env)->GetFieldID (env, cl, "size", "J");
1713 (*env)->SetLongField (env, jr, fl, r->size);
1714 fl = (*env)->GetFieldID (env, cl, "blksize", "J");
1715 (*env)->SetLongField (env, jr, fl, r->blksize);
1716 fl = (*env)->GetFieldID (env, cl, "blocks", "J");
1717 (*env)->SetLongField (env, jr, fl, r->blocks);
1718 fl = (*env)->GetFieldID (env, cl, "atime", "J");
1719 (*env)->SetLongField (env, jr, fl, r->atime);
1720 fl = (*env)->GetFieldID (env, cl, "mtime", "J");
1721 (*env)->SetLongField (env, jr, fl, r->mtime);
1722 fl = (*env)->GetFieldID (env, cl, "ctime", "J");
1723 (*env)->SetLongField (env, jr, fl, r->ctime);
1728 JNIEXPORT jobject JNICALL
1729 Java_com_redhat_et_libguestfs_GuestFS__1lstat
1730 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1732 guestfs_h *g = (guestfs_h *) (long) jg;
1736 struct guestfs_stat *r;
1739 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1740 r = guestfs_lstat (g, path);
1741 (*env)->ReleaseStringUTFChars (env, jpath, path);
1743 throw_exception (env, guestfs_last_error (g));
1746 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/Stat");
1747 jr = (*env)->AllocObject (env, cl);
1748 fl = (*env)->GetFieldID (env, cl, "dev", "J");
1749 (*env)->SetLongField (env, jr, fl, r->dev);
1750 fl = (*env)->GetFieldID (env, cl, "ino", "J");
1751 (*env)->SetLongField (env, jr, fl, r->ino);
1752 fl = (*env)->GetFieldID (env, cl, "mode", "J");
1753 (*env)->SetLongField (env, jr, fl, r->mode);
1754 fl = (*env)->GetFieldID (env, cl, "nlink", "J");
1755 (*env)->SetLongField (env, jr, fl, r->nlink);
1756 fl = (*env)->GetFieldID (env, cl, "uid", "J");
1757 (*env)->SetLongField (env, jr, fl, r->uid);
1758 fl = (*env)->GetFieldID (env, cl, "gid", "J");
1759 (*env)->SetLongField (env, jr, fl, r->gid);
1760 fl = (*env)->GetFieldID (env, cl, "rdev", "J");
1761 (*env)->SetLongField (env, jr, fl, r->rdev);
1762 fl = (*env)->GetFieldID (env, cl, "size", "J");
1763 (*env)->SetLongField (env, jr, fl, r->size);
1764 fl = (*env)->GetFieldID (env, cl, "blksize", "J");
1765 (*env)->SetLongField (env, jr, fl, r->blksize);
1766 fl = (*env)->GetFieldID (env, cl, "blocks", "J");
1767 (*env)->SetLongField (env, jr, fl, r->blocks);
1768 fl = (*env)->GetFieldID (env, cl, "atime", "J");
1769 (*env)->SetLongField (env, jr, fl, r->atime);
1770 fl = (*env)->GetFieldID (env, cl, "mtime", "J");
1771 (*env)->SetLongField (env, jr, fl, r->mtime);
1772 fl = (*env)->GetFieldID (env, cl, "ctime", "J");
1773 (*env)->SetLongField (env, jr, fl, r->ctime);
1778 JNIEXPORT jobject JNICALL
1779 Java_com_redhat_et_libguestfs_GuestFS__1statvfs
1780 (JNIEnv *env, jobject obj, jlong jg, jstring jpath)
1782 guestfs_h *g = (guestfs_h *) (long) jg;
1786 struct guestfs_statvfs *r;
1789 path = (*env)->GetStringUTFChars (env, jpath, NULL);
1790 r = guestfs_statvfs (g, path);
1791 (*env)->ReleaseStringUTFChars (env, jpath, path);
1793 throw_exception (env, guestfs_last_error (g));
1796 cl = (*env)->FindClass (env, "com/redhat/et/libguestfs/StatVFS");
1797 jr = (*env)->AllocObject (env, cl);
1798 fl = (*env)->GetFieldID (env, cl, "bsize", "J");
1799 (*env)->SetLongField (env, jr, fl, r->bsize);
1800 fl = (*env)->GetFieldID (env, cl, "frsize", "J");
1801 (*env)->SetLongField (env, jr, fl, r->frsize);
1802 fl = (*env)->GetFieldID (env, cl, "blocks", "J");
1803 (*env)->SetLongField (env, jr, fl, r->blocks);
1804 fl = (*env)->GetFieldID (env, cl, "bfree", "J");
1805 (*env)->SetLongField (env, jr, fl, r->bfree);
1806 fl = (*env)->GetFieldID (env, cl, "bavail", "J");
1807 (*env)->SetLongField (env, jr, fl, r->bavail);
1808 fl = (*env)->GetFieldID (env, cl, "files", "J");
1809 (*env)->SetLongField (env, jr, fl, r->files);
1810 fl = (*env)->GetFieldID (env, cl, "ffree", "J");
1811 (*env)->SetLongField (env, jr, fl, r->ffree);
1812 fl = (*env)->GetFieldID (env, cl, "favail", "J");
1813 (*env)->SetLongField (env, jr, fl, r->favail);
1814 fl = (*env)->GetFieldID (env, cl, "fsid", "J");
1815 (*env)->SetLongField (env, jr, fl, r->fsid);
1816 fl = (*env)->GetFieldID (env, cl, "flag", "J");
1817 (*env)->SetLongField (env, jr, fl, r->flag);
1818 fl = (*env)->GetFieldID (env, cl, "namemax", "J");
1819 (*env)->SetLongField (env, jr, fl, r->namemax);
1824 JNIEXPORT jobject JNICALL
1825 Java_com_redhat_et_libguestfs_GuestFS__1tune2fs_1l
1826 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1828 guestfs_h *g = (guestfs_h *) (long) jg;
1832 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1833 r = guestfs_tune2fs_l (g, device);
1834 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1836 throw_exception (env, guestfs_last_error (g));
1839 throw_exception (env, "tune2fs_l: internal error: please let us know how to make a Java HashMap from JNI bindings!");
1843 JNIEXPORT void JNICALL
1844 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1setro
1845 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1847 guestfs_h *g = (guestfs_h *) (long) jg;
1851 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1852 r = guestfs_blockdev_setro (g, device);
1853 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1855 throw_exception (env, guestfs_last_error (g));
1860 JNIEXPORT void JNICALL
1861 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1setrw
1862 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1864 guestfs_h *g = (guestfs_h *) (long) jg;
1868 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1869 r = guestfs_blockdev_setrw (g, device);
1870 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1872 throw_exception (env, guestfs_last_error (g));
1877 JNIEXPORT jboolean JNICALL
1878 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1getro
1879 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1881 guestfs_h *g = (guestfs_h *) (long) jg;
1885 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1886 r = guestfs_blockdev_getro (g, device);
1887 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1889 throw_exception (env, guestfs_last_error (g));
1892 return (jboolean) r;
1895 JNIEXPORT jint JNICALL
1896 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1getss
1897 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1899 guestfs_h *g = (guestfs_h *) (long) jg;
1903 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1904 r = guestfs_blockdev_getss (g, device);
1905 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1907 throw_exception (env, guestfs_last_error (g));
1913 JNIEXPORT jint JNICALL
1914 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1getbsz
1915 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1917 guestfs_h *g = (guestfs_h *) (long) jg;
1921 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1922 r = guestfs_blockdev_getbsz (g, device);
1923 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1925 throw_exception (env, guestfs_last_error (g));
1931 JNIEXPORT void JNICALL
1932 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1setbsz
1933 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jint jblocksize)
1935 guestfs_h *g = (guestfs_h *) (long) jg;
1940 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1941 blocksize = jblocksize;
1942 r = guestfs_blockdev_setbsz (g, device, blocksize);
1943 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1945 throw_exception (env, guestfs_last_error (g));
1950 JNIEXPORT jlong JNICALL
1951 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1getsz
1952 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1954 guestfs_h *g = (guestfs_h *) (long) jg;
1958 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1959 r = guestfs_blockdev_getsz (g, device);
1960 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1962 throw_exception (env, guestfs_last_error (g));
1968 JNIEXPORT jlong JNICALL
1969 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1getsize64
1970 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1972 guestfs_h *g = (guestfs_h *) (long) jg;
1976 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1977 r = guestfs_blockdev_getsize64 (g, device);
1978 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1980 throw_exception (env, guestfs_last_error (g));
1986 JNIEXPORT void JNICALL
1987 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1flushbufs
1988 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
1990 guestfs_h *g = (guestfs_h *) (long) jg;
1994 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
1995 r = guestfs_blockdev_flushbufs (g, device);
1996 (*env)->ReleaseStringUTFChars (env, jdevice, device);
1998 throw_exception (env, guestfs_last_error (g));
2003 JNIEXPORT void JNICALL
2004 Java_com_redhat_et_libguestfs_GuestFS__1blockdev_1rereadpt
2005 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2007 guestfs_h *g = (guestfs_h *) (long) jg;
2011 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2012 r = guestfs_blockdev_rereadpt (g, device);
2013 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2015 throw_exception (env, guestfs_last_error (g));
2020 JNIEXPORT void JNICALL
2021 Java_com_redhat_et_libguestfs_GuestFS__1upload
2022 (JNIEnv *env, jobject obj, jlong jg, jstring jfilename, jstring jremotefilename)
2024 guestfs_h *g = (guestfs_h *) (long) jg;
2026 const char *filename;
2027 const char *remotefilename;
2029 filename = (*env)->GetStringUTFChars (env, jfilename, NULL);
2030 remotefilename = (*env)->GetStringUTFChars (env, jremotefilename, NULL);
2031 r = guestfs_upload (g, filename, remotefilename);
2032 (*env)->ReleaseStringUTFChars (env, jfilename, filename);
2033 (*env)->ReleaseStringUTFChars (env, jremotefilename, remotefilename);
2035 throw_exception (env, guestfs_last_error (g));
2040 JNIEXPORT void JNICALL
2041 Java_com_redhat_et_libguestfs_GuestFS__1download
2042 (JNIEnv *env, jobject obj, jlong jg, jstring jremotefilename, jstring jfilename)
2044 guestfs_h *g = (guestfs_h *) (long) jg;
2046 const char *remotefilename;
2047 const char *filename;
2049 remotefilename = (*env)->GetStringUTFChars (env, jremotefilename, NULL);
2050 filename = (*env)->GetStringUTFChars (env, jfilename, NULL);
2051 r = guestfs_download (g, remotefilename, filename);
2052 (*env)->ReleaseStringUTFChars (env, jremotefilename, remotefilename);
2053 (*env)->ReleaseStringUTFChars (env, jfilename, filename);
2055 throw_exception (env, guestfs_last_error (g));
2060 JNIEXPORT jstring JNICALL
2061 Java_com_redhat_et_libguestfs_GuestFS__1checksum
2062 (JNIEnv *env, jobject obj, jlong jg, jstring jcsumtype, jstring jpath)
2064 guestfs_h *g = (guestfs_h *) (long) jg;
2067 const char *csumtype;
2070 csumtype = (*env)->GetStringUTFChars (env, jcsumtype, NULL);
2071 path = (*env)->GetStringUTFChars (env, jpath, NULL);
2072 r = guestfs_checksum (g, csumtype, path);
2073 (*env)->ReleaseStringUTFChars (env, jcsumtype, csumtype);
2074 (*env)->ReleaseStringUTFChars (env, jpath, path);
2076 throw_exception (env, guestfs_last_error (g));
2079 jr = (*env)->NewStringUTF (env, r);
2084 JNIEXPORT void JNICALL
2085 Java_com_redhat_et_libguestfs_GuestFS__1tar_1in
2086 (JNIEnv *env, jobject obj, jlong jg, jstring jtarfile, jstring jdirectory)
2088 guestfs_h *g = (guestfs_h *) (long) jg;
2090 const char *tarfile;
2091 const char *directory;
2093 tarfile = (*env)->GetStringUTFChars (env, jtarfile, NULL);
2094 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
2095 r = guestfs_tar_in (g, tarfile, directory);
2096 (*env)->ReleaseStringUTFChars (env, jtarfile, tarfile);
2097 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
2099 throw_exception (env, guestfs_last_error (g));
2104 JNIEXPORT void JNICALL
2105 Java_com_redhat_et_libguestfs_GuestFS__1tar_1out
2106 (JNIEnv *env, jobject obj, jlong jg, jstring jdirectory, jstring jtarfile)
2108 guestfs_h *g = (guestfs_h *) (long) jg;
2110 const char *directory;
2111 const char *tarfile;
2113 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
2114 tarfile = (*env)->GetStringUTFChars (env, jtarfile, NULL);
2115 r = guestfs_tar_out (g, directory, tarfile);
2116 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
2117 (*env)->ReleaseStringUTFChars (env, jtarfile, tarfile);
2119 throw_exception (env, guestfs_last_error (g));
2124 JNIEXPORT void JNICALL
2125 Java_com_redhat_et_libguestfs_GuestFS__1tgz_1in
2126 (JNIEnv *env, jobject obj, jlong jg, jstring jtarball, jstring jdirectory)
2128 guestfs_h *g = (guestfs_h *) (long) jg;
2130 const char *tarball;
2131 const char *directory;
2133 tarball = (*env)->GetStringUTFChars (env, jtarball, NULL);
2134 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
2135 r = guestfs_tgz_in (g, tarball, directory);
2136 (*env)->ReleaseStringUTFChars (env, jtarball, tarball);
2137 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
2139 throw_exception (env, guestfs_last_error (g));
2144 JNIEXPORT void JNICALL
2145 Java_com_redhat_et_libguestfs_GuestFS__1tgz_1out
2146 (JNIEnv *env, jobject obj, jlong jg, jstring jdirectory, jstring jtarball)
2148 guestfs_h *g = (guestfs_h *) (long) jg;
2150 const char *directory;
2151 const char *tarball;
2153 directory = (*env)->GetStringUTFChars (env, jdirectory, NULL);
2154 tarball = (*env)->GetStringUTFChars (env, jtarball, NULL);
2155 r = guestfs_tgz_out (g, directory, tarball);
2156 (*env)->ReleaseStringUTFChars (env, jdirectory, directory);
2157 (*env)->ReleaseStringUTFChars (env, jtarball, tarball);
2159 throw_exception (env, guestfs_last_error (g));
2164 JNIEXPORT void JNICALL
2165 Java_com_redhat_et_libguestfs_GuestFS__1mount_1ro
2166 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jmountpoint)
2168 guestfs_h *g = (guestfs_h *) (long) jg;
2171 const char *mountpoint;
2173 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2174 mountpoint = (*env)->GetStringUTFChars (env, jmountpoint, NULL);
2175 r = guestfs_mount_ro (g, device, mountpoint);
2176 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2177 (*env)->ReleaseStringUTFChars (env, jmountpoint, mountpoint);
2179 throw_exception (env, guestfs_last_error (g));
2184 JNIEXPORT void JNICALL
2185 Java_com_redhat_et_libguestfs_GuestFS__1mount_1options
2186 (JNIEnv *env, jobject obj, jlong jg, jstring joptions, jstring jdevice, jstring jmountpoint)
2188 guestfs_h *g = (guestfs_h *) (long) jg;
2190 const char *options;
2192 const char *mountpoint;
2194 options = (*env)->GetStringUTFChars (env, joptions, NULL);
2195 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2196 mountpoint = (*env)->GetStringUTFChars (env, jmountpoint, NULL);
2197 r = guestfs_mount_options (g, options, device, mountpoint);
2198 (*env)->ReleaseStringUTFChars (env, joptions, options);
2199 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2200 (*env)->ReleaseStringUTFChars (env, jmountpoint, mountpoint);
2202 throw_exception (env, guestfs_last_error (g));
2207 JNIEXPORT void JNICALL
2208 Java_com_redhat_et_libguestfs_GuestFS__1mount_1vfs
2209 (JNIEnv *env, jobject obj, jlong jg, jstring joptions, jstring jvfstype, jstring jdevice, jstring jmountpoint)
2211 guestfs_h *g = (guestfs_h *) (long) jg;
2213 const char *options;
2214 const char *vfstype;
2216 const char *mountpoint;
2218 options = (*env)->GetStringUTFChars (env, joptions, NULL);
2219 vfstype = (*env)->GetStringUTFChars (env, jvfstype, NULL);
2220 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2221 mountpoint = (*env)->GetStringUTFChars (env, jmountpoint, NULL);
2222 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2223 (*env)->ReleaseStringUTFChars (env, joptions, options);
2224 (*env)->ReleaseStringUTFChars (env, jvfstype, vfstype);
2225 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2226 (*env)->ReleaseStringUTFChars (env, jmountpoint, mountpoint);
2228 throw_exception (env, guestfs_last_error (g));
2233 JNIEXPORT jstring JNICALL
2234 Java_com_redhat_et_libguestfs_GuestFS__1debug
2235 (JNIEnv *env, jobject obj, jlong jg, jstring jsubcmd, jobjectArray jextraargs)
2237 guestfs_h *g = (guestfs_h *) (long) jg;
2242 const char **extraargs;
2245 subcmd = (*env)->GetStringUTFChars (env, jsubcmd, NULL);
2246 extraargs_len = (*env)->GetArrayLength (env, jextraargs);
2247 extraargs = guestfs_safe_malloc (g, sizeof (char *) * (extraargs_len+1));
2248 for (i = 0; i < extraargs_len; ++i) {
2249 jobject o = (*env)->GetObjectArrayElement (env, jextraargs, i);
2250 extraargs[i] = (*env)->GetStringUTFChars (env, o, NULL);
2252 extraargs[extraargs_len] = NULL;
2253 r = guestfs_debug (g, subcmd, extraargs);
2254 (*env)->ReleaseStringUTFChars (env, jsubcmd, subcmd);
2255 for (i = 0; i < extraargs_len; ++i) {
2256 jobject o = (*env)->GetObjectArrayElement (env, jextraargs, i);
2257 (*env)->ReleaseStringUTFChars (env, o, extraargs[i]);
2261 throw_exception (env, guestfs_last_error (g));
2264 jr = (*env)->NewStringUTF (env, r);
2269 JNIEXPORT void JNICALL
2270 Java_com_redhat_et_libguestfs_GuestFS__1lvremove
2271 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2273 guestfs_h *g = (guestfs_h *) (long) jg;
2277 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2278 r = guestfs_lvremove (g, device);
2279 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2281 throw_exception (env, guestfs_last_error (g));
2286 JNIEXPORT void JNICALL
2287 Java_com_redhat_et_libguestfs_GuestFS__1vgremove
2288 (JNIEnv *env, jobject obj, jlong jg, jstring jvgname)
2290 guestfs_h *g = (guestfs_h *) (long) jg;
2294 vgname = (*env)->GetStringUTFChars (env, jvgname, NULL);
2295 r = guestfs_vgremove (g, vgname);
2296 (*env)->ReleaseStringUTFChars (env, jvgname, vgname);
2298 throw_exception (env, guestfs_last_error (g));
2303 JNIEXPORT void JNICALL
2304 Java_com_redhat_et_libguestfs_GuestFS__1pvremove
2305 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2307 guestfs_h *g = (guestfs_h *) (long) jg;
2311 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2312 r = guestfs_pvremove (g, device);
2313 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2315 throw_exception (env, guestfs_last_error (g));
2320 JNIEXPORT void JNICALL
2321 Java_com_redhat_et_libguestfs_GuestFS__1set_1e2label
2322 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring jlabel)
2324 guestfs_h *g = (guestfs_h *) (long) jg;
2329 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2330 label = (*env)->GetStringUTFChars (env, jlabel, NULL);
2331 r = guestfs_set_e2label (g, device, label);
2332 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2333 (*env)->ReleaseStringUTFChars (env, jlabel, label);
2335 throw_exception (env, guestfs_last_error (g));
2340 JNIEXPORT jstring JNICALL
2341 Java_com_redhat_et_libguestfs_GuestFS__1get_1e2label
2342 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2344 guestfs_h *g = (guestfs_h *) (long) jg;
2349 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2350 r = guestfs_get_e2label (g, device);
2351 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2353 throw_exception (env, guestfs_last_error (g));
2356 jr = (*env)->NewStringUTF (env, r);
2361 JNIEXPORT void JNICALL
2362 Java_com_redhat_et_libguestfs_GuestFS__1set_1e2uuid
2363 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice, jstring juuid)
2365 guestfs_h *g = (guestfs_h *) (long) jg;
2370 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2371 uuid = (*env)->GetStringUTFChars (env, juuid, NULL);
2372 r = guestfs_set_e2uuid (g, device, uuid);
2373 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2374 (*env)->ReleaseStringUTFChars (env, juuid, uuid);
2376 throw_exception (env, guestfs_last_error (g));
2381 JNIEXPORT jstring JNICALL
2382 Java_com_redhat_et_libguestfs_GuestFS__1get_1e2uuid
2383 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2385 guestfs_h *g = (guestfs_h *) (long) jg;
2390 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2391 r = guestfs_get_e2uuid (g, device);
2392 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2394 throw_exception (env, guestfs_last_error (g));
2397 jr = (*env)->NewStringUTF (env, r);
2402 JNIEXPORT jint JNICALL
2403 Java_com_redhat_et_libguestfs_GuestFS__1fsck
2404 (JNIEnv *env, jobject obj, jlong jg, jstring jfstype, jstring jdevice)
2406 guestfs_h *g = (guestfs_h *) (long) jg;
2411 fstype = (*env)->GetStringUTFChars (env, jfstype, NULL);
2412 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2413 r = guestfs_fsck (g, fstype, device);
2414 (*env)->ReleaseStringUTFChars (env, jfstype, fstype);
2415 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2417 throw_exception (env, guestfs_last_error (g));
2423 JNIEXPORT void JNICALL
2424 Java_com_redhat_et_libguestfs_GuestFS__1zero
2425 (JNIEnv *env, jobject obj, jlong jg, jstring jdevice)
2427 guestfs_h *g = (guestfs_h *) (long) jg;
2431 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2432 r = guestfs_zero (g, device);
2433 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2435 throw_exception (env, guestfs_last_error (g));
2440 JNIEXPORT void JNICALL
2441 Java_com_redhat_et_libguestfs_GuestFS__1grub_1install
2442 (JNIEnv *env, jobject obj, jlong jg, jstring jroot, jstring jdevice)
2444 guestfs_h *g = (guestfs_h *) (long) jg;
2449 root = (*env)->GetStringUTFChars (env, jroot, NULL);
2450 device = (*env)->GetStringUTFChars (env, jdevice, NULL);
2451 r = guestfs_grub_install (g, root, device);
2452 (*env)->ReleaseStringUTFChars (env, jroot, root);
2453 (*env)->ReleaseStringUTFChars (env, jdevice, device);
2455 throw_exception (env, guestfs_last_error (g));