Merge branch 'master' of git://git.et.redhat.com/libguestfs
[libguestfs.git] / java / com / redhat / et / libguestfs / GuestFS.java
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.
4  *
5  * Copyright (C) 2009 Red Hat Inc.
6  *
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.
11  *
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.
16  *
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
20  */
21
22 package com.redhat.et.libguestfs;
23
24 import java.util.HashMap;
25 import com.redhat.et.libguestfs.LibGuestFSException;
26 import com.redhat.et.libguestfs.PV;
27 import com.redhat.et.libguestfs.VG;
28 import com.redhat.et.libguestfs.LV;
29 import com.redhat.et.libguestfs.Stat;
30 import com.redhat.et.libguestfs.StatVFS;
31 import com.redhat.et.libguestfs.IntBool;
32
33 /**
34  * The GuestFS object is a libguestfs handle.
35  *
36  * @author rjones
37  */
38 public class GuestFS {
39   // Load the native code.
40   static {
41     System.loadLibrary ("guestfs_jni");
42   }
43
44   /**
45    * The native guestfs_h pointer.
46    */
47   long g;
48
49   /**
50    * Create a libguestfs handle.
51    *
52    * @throws LibGuestFSException
53    */
54   public GuestFS () throws LibGuestFSException
55   {
56     g = _create ();
57   }
58   private native long _create () throws LibGuestFSException;
59
60   /**
61    * Close a libguestfs handle.
62    *
63    * You can also leave handles to be collected by the garbage
64    * collector, but this method ensures that the resources used
65    * by the handle are freed up immediately.  If you call any
66    * other methods after closing the handle, you will get an
67    * exception.
68    *
69    * @throws LibGuestFSException
70    */
71   public void close () throws LibGuestFSException
72   {
73     if (g != 0)
74       _close (g);
75     g = 0;
76   }
77   private native void _close (long g) throws LibGuestFSException;
78
79   public void finalize () throws LibGuestFSException
80   {
81     close ();
82   }
83
84 public void test0 (String str, String optstr, String[] strlist, boolean b, int integer, String filein, String fileout)
85     throws LibGuestFSException
86   {
87     if (g == 0)
88       throw new LibGuestFSException ("test0: handle is closed");
89     _test0 (g, str, optstr, strlist, b, integer, filein, fileout);
90   }
91   private native void _test0 (long g, String str, String optstr, String[] strlist, boolean b, int integer, String filein, String fileout)
92     throws LibGuestFSException;
93
94 public int test0rint (String val)
95     throws LibGuestFSException
96   {
97     if (g == 0)
98       throw new LibGuestFSException ("test0rint: handle is closed");
99     return _test0rint (g, val);
100   }
101   private native int _test0rint (long g, String val)
102     throws LibGuestFSException;
103
104 public int test0rinterr ()
105     throws LibGuestFSException
106   {
107     if (g == 0)
108       throw new LibGuestFSException ("test0rinterr: handle is closed");
109     return _test0rinterr (g);
110   }
111   private native int _test0rinterr (long g)
112     throws LibGuestFSException;
113
114 public long test0rint64 (String val)
115     throws LibGuestFSException
116   {
117     if (g == 0)
118       throw new LibGuestFSException ("test0rint64: handle is closed");
119     return _test0rint64 (g, val);
120   }
121   private native long _test0rint64 (long g, String val)
122     throws LibGuestFSException;
123
124 public long test0rint64err ()
125     throws LibGuestFSException
126   {
127     if (g == 0)
128       throw new LibGuestFSException ("test0rint64err: handle is closed");
129     return _test0rint64err (g);
130   }
131   private native long _test0rint64err (long g)
132     throws LibGuestFSException;
133
134 public boolean test0rbool (String val)
135     throws LibGuestFSException
136   {
137     if (g == 0)
138       throw new LibGuestFSException ("test0rbool: handle is closed");
139     return _test0rbool (g, val);
140   }
141   private native boolean _test0rbool (long g, String val)
142     throws LibGuestFSException;
143
144 public boolean test0rboolerr ()
145     throws LibGuestFSException
146   {
147     if (g == 0)
148       throw new LibGuestFSException ("test0rboolerr: handle is closed");
149     return _test0rboolerr (g);
150   }
151   private native boolean _test0rboolerr (long g)
152     throws LibGuestFSException;
153
154 public String test0rconststring (String val)
155     throws LibGuestFSException
156   {
157     if (g == 0)
158       throw new LibGuestFSException ("test0rconststring: handle is closed");
159     return _test0rconststring (g, val);
160   }
161   private native String _test0rconststring (long g, String val)
162     throws LibGuestFSException;
163
164 public String test0rconststringerr ()
165     throws LibGuestFSException
166   {
167     if (g == 0)
168       throw new LibGuestFSException ("test0rconststringerr: handle is closed");
169     return _test0rconststringerr (g);
170   }
171   private native String _test0rconststringerr (long g)
172     throws LibGuestFSException;
173
174 public String test0rstring (String val)
175     throws LibGuestFSException
176   {
177     if (g == 0)
178       throw new LibGuestFSException ("test0rstring: handle is closed");
179     return _test0rstring (g, val);
180   }
181   private native String _test0rstring (long g, String val)
182     throws LibGuestFSException;
183
184 public String test0rstringerr ()
185     throws LibGuestFSException
186   {
187     if (g == 0)
188       throw new LibGuestFSException ("test0rstringerr: handle is closed");
189     return _test0rstringerr (g);
190   }
191   private native String _test0rstringerr (long g)
192     throws LibGuestFSException;
193
194 public String[] test0rstringlist (String val)
195     throws LibGuestFSException
196   {
197     if (g == 0)
198       throw new LibGuestFSException ("test0rstringlist: handle is closed");
199     return _test0rstringlist (g, val);
200   }
201   private native String[] _test0rstringlist (long g, String val)
202     throws LibGuestFSException;
203
204 public String[] test0rstringlisterr ()
205     throws LibGuestFSException
206   {
207     if (g == 0)
208       throw new LibGuestFSException ("test0rstringlisterr: handle is closed");
209     return _test0rstringlisterr (g);
210   }
211   private native String[] _test0rstringlisterr (long g)
212     throws LibGuestFSException;
213
214 public IntBool test0rintbool (String val)
215     throws LibGuestFSException
216   {
217     if (g == 0)
218       throw new LibGuestFSException ("test0rintbool: handle is closed");
219     return _test0rintbool (g, val);
220   }
221   private native IntBool _test0rintbool (long g, String val)
222     throws LibGuestFSException;
223
224 public IntBool test0rintboolerr ()
225     throws LibGuestFSException
226   {
227     if (g == 0)
228       throw new LibGuestFSException ("test0rintboolerr: handle is closed");
229     return _test0rintboolerr (g);
230   }
231   private native IntBool _test0rintboolerr (long g)
232     throws LibGuestFSException;
233
234 public PV[] test0rpvlist (String val)
235     throws LibGuestFSException
236   {
237     if (g == 0)
238       throw new LibGuestFSException ("test0rpvlist: handle is closed");
239     return _test0rpvlist (g, val);
240   }
241   private native PV[] _test0rpvlist (long g, String val)
242     throws LibGuestFSException;
243
244 public PV[] test0rpvlisterr ()
245     throws LibGuestFSException
246   {
247     if (g == 0)
248       throw new LibGuestFSException ("test0rpvlisterr: handle is closed");
249     return _test0rpvlisterr (g);
250   }
251   private native PV[] _test0rpvlisterr (long g)
252     throws LibGuestFSException;
253
254 public VG[] test0rvglist (String val)
255     throws LibGuestFSException
256   {
257     if (g == 0)
258       throw new LibGuestFSException ("test0rvglist: handle is closed");
259     return _test0rvglist (g, val);
260   }
261   private native VG[] _test0rvglist (long g, String val)
262     throws LibGuestFSException;
263
264 public VG[] test0rvglisterr ()
265     throws LibGuestFSException
266   {
267     if (g == 0)
268       throw new LibGuestFSException ("test0rvglisterr: handle is closed");
269     return _test0rvglisterr (g);
270   }
271   private native VG[] _test0rvglisterr (long g)
272     throws LibGuestFSException;
273
274 public LV[] test0rlvlist (String val)
275     throws LibGuestFSException
276   {
277     if (g == 0)
278       throw new LibGuestFSException ("test0rlvlist: handle is closed");
279     return _test0rlvlist (g, val);
280   }
281   private native LV[] _test0rlvlist (long g, String val)
282     throws LibGuestFSException;
283
284 public LV[] test0rlvlisterr ()
285     throws LibGuestFSException
286   {
287     if (g == 0)
288       throw new LibGuestFSException ("test0rlvlisterr: handle is closed");
289     return _test0rlvlisterr (g);
290   }
291   private native LV[] _test0rlvlisterr (long g)
292     throws LibGuestFSException;
293
294 public Stat test0rstat (String val)
295     throws LibGuestFSException
296   {
297     if (g == 0)
298       throw new LibGuestFSException ("test0rstat: handle is closed");
299     return _test0rstat (g, val);
300   }
301   private native Stat _test0rstat (long g, String val)
302     throws LibGuestFSException;
303
304 public Stat test0rstaterr ()
305     throws LibGuestFSException
306   {
307     if (g == 0)
308       throw new LibGuestFSException ("test0rstaterr: handle is closed");
309     return _test0rstaterr (g);
310   }
311   private native Stat _test0rstaterr (long g)
312     throws LibGuestFSException;
313
314 public StatVFS test0rstatvfs (String val)
315     throws LibGuestFSException
316   {
317     if (g == 0)
318       throw new LibGuestFSException ("test0rstatvfs: handle is closed");
319     return _test0rstatvfs (g, val);
320   }
321   private native StatVFS _test0rstatvfs (long g, String val)
322     throws LibGuestFSException;
323
324 public StatVFS test0rstatvfserr ()
325     throws LibGuestFSException
326   {
327     if (g == 0)
328       throw new LibGuestFSException ("test0rstatvfserr: handle is closed");
329     return _test0rstatvfserr (g);
330   }
331   private native StatVFS _test0rstatvfserr (long g)
332     throws LibGuestFSException;
333
334 public HashMap<String,String> test0rhashtable (String val)
335     throws LibGuestFSException
336   {
337     if (g == 0)
338       throw new LibGuestFSException ("test0rhashtable: handle is closed");
339     return _test0rhashtable (g, val);
340   }
341   private native HashMap<String,String> _test0rhashtable (long g, String val)
342     throws LibGuestFSException;
343
344 public HashMap<String,String> test0rhashtableerr ()
345     throws LibGuestFSException
346   {
347     if (g == 0)
348       throw new LibGuestFSException ("test0rhashtableerr: handle is closed");
349     return _test0rhashtableerr (g);
350   }
351   private native HashMap<String,String> _test0rhashtableerr (long g)
352     throws LibGuestFSException;
353
354   /**
355    * launch the qemu subprocess
356    * <p>
357    * Internally libguestfs is implemented by running a
358    * virtual machine using qemu(1).
359    * <p>
360    * You should call this after configuring the handle (eg.
361    * adding drives) but before performing any actions.
362    * <p>
363    * @throws LibGuestFSException
364    */
365   public void launch ()
366     throws LibGuestFSException
367   {
368     if (g == 0)
369       throw new LibGuestFSException ("launch: handle is closed");
370     _launch (g);
371   }
372   private native void _launch (long g)
373     throws LibGuestFSException;
374
375   /**
376    * wait until the qemu subprocess launches
377    * <p>
378    * Internally libguestfs is implemented by running a
379    * virtual machine using qemu(1).
380    * <p>
381    * You should call this after "g.launch" to wait for the
382    * launch to complete.
383    * <p>
384    * @throws LibGuestFSException
385    */
386   public void wait_ready ()
387     throws LibGuestFSException
388   {
389     if (g == 0)
390       throw new LibGuestFSException ("wait_ready: handle is closed");
391     _wait_ready (g);
392   }
393   private native void _wait_ready (long g)
394     throws LibGuestFSException;
395
396   /**
397    * kill the qemu subprocess
398    * <p>
399    * This kills the qemu subprocess. You should never need to
400    * call this.
401    * <p>
402    * @throws LibGuestFSException
403    */
404   public void kill_subprocess ()
405     throws LibGuestFSException
406   {
407     if (g == 0)
408       throw new LibGuestFSException ("kill_subprocess: handle is closed");
409     _kill_subprocess (g);
410   }
411   private native void _kill_subprocess (long g)
412     throws LibGuestFSException;
413
414   /**
415    * add an image to examine or modify
416    * <p>
417    * This function adds a virtual machine disk image
418    * "filename" to the guest. The first time you call this
419    * function, the disk appears as IDE disk 0 ("/dev/sda") in
420    * the guest, the second time as "/dev/sdb", and so on.
421    * <p>
422    * You don't necessarily need to be root when using
423    * libguestfs. However you obviously do need sufficient
424    * permissions to access the filename for whatever
425    * operations you want to perform (ie. read access if you
426    * just want to read the image or write access if you want
427    * to modify the image).
428    * <p>
429    * This is equivalent to the qemu parameter "-drive
430    * file=filename".
431    * <p>
432    * Note that this call checks for the existence of
433    * "filename". This stops you from specifying other types
434    * of drive which are supported by qemu such as "nbd:" and
435    * "http:" URLs. To specify those, use the general
436    * "g.config" call instead.
437    * <p>
438    * @throws LibGuestFSException
439    */
440   public void add_drive (String filename)
441     throws LibGuestFSException
442   {
443     if (g == 0)
444       throw new LibGuestFSException ("add_drive: handle is closed");
445     _add_drive (g, filename);
446   }
447   private native void _add_drive (long g, String filename)
448     throws LibGuestFSException;
449
450   /**
451    * add a CD-ROM disk image to examine
452    * <p>
453    * This function adds a virtual CD-ROM disk image to the
454    * guest.
455    * <p>
456    * This is equivalent to the qemu parameter "-cdrom
457    * filename".
458    * <p>
459    * Note that this call checks for the existence of
460    * "filename". This stops you from specifying other types
461    * of drive which are supported by qemu such as "nbd:" and
462    * "http:" URLs. To specify those, use the general
463    * "g.config" call instead.
464    * <p>
465    * @throws LibGuestFSException
466    */
467   public void add_cdrom (String filename)
468     throws LibGuestFSException
469   {
470     if (g == 0)
471       throw new LibGuestFSException ("add_cdrom: handle is closed");
472     _add_cdrom (g, filename);
473   }
474   private native void _add_cdrom (long g, String filename)
475     throws LibGuestFSException;
476
477   /**
478    * add a drive in snapshot mode (read-only)
479    * <p>
480    * This adds a drive in snapshot mode, making it
481    * effectively read-only.
482    * <p>
483    * Note that writes to the device are allowed, and will be
484    * seen for the duration of the guestfs handle, but they
485    * are written to a temporary file which is discarded as
486    * soon as the guestfs handle is closed. We don't currently
487    * have any method to enable changes to be committed,
488    * although qemu can support this.
489    * <p>
490    * This is equivalent to the qemu parameter "-drive
491    * file=filename,snapshot=on".
492    * <p>
493    * Note that this call checks for the existence of
494    * "filename". This stops you from specifying other types
495    * of drive which are supported by qemu such as "nbd:" and
496    * "http:" URLs. To specify those, use the general
497    * "g.config" call instead.
498    * <p>
499    * @throws LibGuestFSException
500    */
501   public void add_drive_ro (String filename)
502     throws LibGuestFSException
503   {
504     if (g == 0)
505       throw new LibGuestFSException ("add_drive_ro: handle is closed");
506     _add_drive_ro (g, filename);
507   }
508   private native void _add_drive_ro (long g, String filename)
509     throws LibGuestFSException;
510
511   /**
512    * add qemu parameters
513    * <p>
514    * This can be used to add arbitrary qemu command line
515    * parameters of the form "-param value". Actually it's not
516    * quite arbitrary - we prevent you from setting some
517    * parameters which would interfere with parameters that we
518    * use.
519    * <p>
520    * The first character of "param" string must be a "-"
521    * (dash).
522    * <p>
523    * "value" can be NULL.
524    * <p>
525    * @throws LibGuestFSException
526    */
527   public void config (String qemuparam, String qemuvalue)
528     throws LibGuestFSException
529   {
530     if (g == 0)
531       throw new LibGuestFSException ("config: handle is closed");
532     _config (g, qemuparam, qemuvalue);
533   }
534   private native void _config (long g, String qemuparam, String qemuvalue)
535     throws LibGuestFSException;
536
537   /**
538    * set the qemu binary
539    * <p>
540    * Set the qemu binary that we will use.
541    * <p>
542    * The default is chosen when the library was compiled by
543    * the configure script.
544    * <p>
545    * You can also override this by setting the
546    * "LIBGUESTFS_QEMU" environment variable.
547    * <p>
548    * Setting "qemu" to "NULL" restores the default qemu
549    * binary.
550    * <p>
551    * @throws LibGuestFSException
552    */
553   public void set_qemu (String qemu)
554     throws LibGuestFSException
555   {
556     if (g == 0)
557       throw new LibGuestFSException ("set_qemu: handle is closed");
558     _set_qemu (g, qemu);
559   }
560   private native void _set_qemu (long g, String qemu)
561     throws LibGuestFSException;
562
563   /**
564    * get the qemu binary
565    * <p>
566    * Return the current qemu binary.
567    * <p>
568    * This is always non-NULL. If it wasn't set already, then
569    * this will return the default qemu binary name.
570    * <p>
571    * @throws LibGuestFSException
572    */
573   public String get_qemu ()
574     throws LibGuestFSException
575   {
576     if (g == 0)
577       throw new LibGuestFSException ("get_qemu: handle is closed");
578     return _get_qemu (g);
579   }
580   private native String _get_qemu (long g)
581     throws LibGuestFSException;
582
583   /**
584    * set the search path
585    * <p>
586    * Set the path that libguestfs searches for kernel and
587    * initrd.img.
588    * <p>
589    * The default is "$libdir/guestfs" unless overridden by
590    * setting "LIBGUESTFS_PATH" environment variable.
591    * <p>
592    * Setting "path" to "NULL" restores the default path.
593    * <p>
594    * @throws LibGuestFSException
595    */
596   public void set_path (String path)
597     throws LibGuestFSException
598   {
599     if (g == 0)
600       throw new LibGuestFSException ("set_path: handle is closed");
601     _set_path (g, path);
602   }
603   private native void _set_path (long g, String path)
604     throws LibGuestFSException;
605
606   /**
607    * get the search path
608    * <p>
609    * Return the current search path.
610    * <p>
611    * This is always non-NULL. If it wasn't set already, then
612    * this will return the default path.
613    * <p>
614    * @throws LibGuestFSException
615    */
616   public String get_path ()
617     throws LibGuestFSException
618   {
619     if (g == 0)
620       throw new LibGuestFSException ("get_path: handle is closed");
621     return _get_path (g);
622   }
623   private native String _get_path (long g)
624     throws LibGuestFSException;
625
626   /**
627    * add options to kernel command line
628    * <p>
629    * This function is used to add additional options to the
630    * guest kernel command line.
631    * <p>
632    * The default is "NULL" unless overridden by setting
633    * "LIBGUESTFS_APPEND" environment variable.
634    * <p>
635    * Setting "append" to "NULL" means *no* additional options
636    * are passed (libguestfs always adds a few of its own).
637    * <p>
638    * @throws LibGuestFSException
639    */
640   public void set_append (String append)
641     throws LibGuestFSException
642   {
643     if (g == 0)
644       throw new LibGuestFSException ("set_append: handle is closed");
645     _set_append (g, append);
646   }
647   private native void _set_append (long g, String append)
648     throws LibGuestFSException;
649
650   /**
651    * get the additional kernel options
652    * <p>
653    * Return the additional kernel options which are added to
654    * the guest kernel command line.
655    * <p>
656    * If "NULL" then no options are added.
657    * <p>
658    * @throws LibGuestFSException
659    */
660   public String get_append ()
661     throws LibGuestFSException
662   {
663     if (g == 0)
664       throw new LibGuestFSException ("get_append: handle is closed");
665     return _get_append (g);
666   }
667   private native String _get_append (long g)
668     throws LibGuestFSException;
669
670   /**
671    * set autosync mode
672    * <p>
673    * If "autosync" is true, this enables autosync. Libguestfs
674    * will make a best effort attempt to run "g.umount_all"
675    * followed by "g.sync" when the handle is closed (also if
676    * the program exits without closing handles).
677    * <p>
678    * This is disabled by default (except in guestfish where
679    * it is enabled by default).
680    * <p>
681    * @throws LibGuestFSException
682    */
683   public void set_autosync (boolean autosync)
684     throws LibGuestFSException
685   {
686     if (g == 0)
687       throw new LibGuestFSException ("set_autosync: handle is closed");
688     _set_autosync (g, autosync);
689   }
690   private native void _set_autosync (long g, boolean autosync)
691     throws LibGuestFSException;
692
693   /**
694    * get autosync mode
695    * <p>
696    * Get the autosync flag.
697    * <p>
698    * @throws LibGuestFSException
699    */
700   public boolean get_autosync ()
701     throws LibGuestFSException
702   {
703     if (g == 0)
704       throw new LibGuestFSException ("get_autosync: handle is closed");
705     return _get_autosync (g);
706   }
707   private native boolean _get_autosync (long g)
708     throws LibGuestFSException;
709
710   /**
711    * set verbose mode
712    * <p>
713    * If "verbose" is true, this turns on verbose messages (to
714    * "stderr").
715    * <p>
716    * Verbose messages are disabled unless the environment
717    * variable "LIBGUESTFS_DEBUG" is defined and set to 1.
718    * <p>
719    * @throws LibGuestFSException
720    */
721   public void set_verbose (boolean verbose)
722     throws LibGuestFSException
723   {
724     if (g == 0)
725       throw new LibGuestFSException ("set_verbose: handle is closed");
726     _set_verbose (g, verbose);
727   }
728   private native void _set_verbose (long g, boolean verbose)
729     throws LibGuestFSException;
730
731   /**
732    * get verbose mode
733    * <p>
734    * This returns the verbose messages flag.
735    * <p>
736    * @throws LibGuestFSException
737    */
738   public boolean get_verbose ()
739     throws LibGuestFSException
740   {
741     if (g == 0)
742       throw new LibGuestFSException ("get_verbose: handle is closed");
743     return _get_verbose (g);
744   }
745   private native boolean _get_verbose (long g)
746     throws LibGuestFSException;
747
748   /**
749    * is ready to accept commands
750    * <p>
751    * This returns true iff this handle is ready to accept
752    * commands (in the "READY" state).
753    * <p>
754    * For more information on states, see guestfs(3).
755    * <p>
756    * @throws LibGuestFSException
757    */
758   public boolean is_ready ()
759     throws LibGuestFSException
760   {
761     if (g == 0)
762       throw new LibGuestFSException ("is_ready: handle is closed");
763     return _is_ready (g);
764   }
765   private native boolean _is_ready (long g)
766     throws LibGuestFSException;
767
768   /**
769    * is in configuration state
770    * <p>
771    * This returns true iff this handle is being configured
772    * (in the "CONFIG" state).
773    * <p>
774    * For more information on states, see guestfs(3).
775    * <p>
776    * @throws LibGuestFSException
777    */
778   public boolean is_config ()
779     throws LibGuestFSException
780   {
781     if (g == 0)
782       throw new LibGuestFSException ("is_config: handle is closed");
783     return _is_config (g);
784   }
785   private native boolean _is_config (long g)
786     throws LibGuestFSException;
787
788   /**
789    * is launching subprocess
790    * <p>
791    * This returns true iff this handle is launching the
792    * subprocess (in the "LAUNCHING" state).
793    * <p>
794    * For more information on states, see guestfs(3).
795    * <p>
796    * @throws LibGuestFSException
797    */
798   public boolean is_launching ()
799     throws LibGuestFSException
800   {
801     if (g == 0)
802       throw new LibGuestFSException ("is_launching: handle is closed");
803     return _is_launching (g);
804   }
805   private native boolean _is_launching (long g)
806     throws LibGuestFSException;
807
808   /**
809    * is busy processing a command
810    * <p>
811    * This returns true iff this handle is busy processing a
812    * command (in the "BUSY" state).
813    * <p>
814    * For more information on states, see guestfs(3).
815    * <p>
816    * @throws LibGuestFSException
817    */
818   public boolean is_busy ()
819     throws LibGuestFSException
820   {
821     if (g == 0)
822       throw new LibGuestFSException ("is_busy: handle is closed");
823     return _is_busy (g);
824   }
825   private native boolean _is_busy (long g)
826     throws LibGuestFSException;
827
828   /**
829    * get the current state
830    * <p>
831    * This returns the current state as an opaque integer.
832    * This is only useful for printing debug and internal
833    * error messages.
834    * <p>
835    * For more information on states, see guestfs(3).
836    * <p>
837    * @throws LibGuestFSException
838    */
839   public int get_state ()
840     throws LibGuestFSException
841   {
842     if (g == 0)
843       throw new LibGuestFSException ("get_state: handle is closed");
844     return _get_state (g);
845   }
846   private native int _get_state (long g)
847     throws LibGuestFSException;
848
849   /**
850    * set state to busy
851    * <p>
852    * This sets the state to "BUSY". This is only used when
853    * implementing actions using the low-level API.
854    * <p>
855    * For more information on states, see guestfs(3).
856    * <p>
857    * @throws LibGuestFSException
858    */
859   public void set_busy ()
860     throws LibGuestFSException
861   {
862     if (g == 0)
863       throw new LibGuestFSException ("set_busy: handle is closed");
864     _set_busy (g);
865   }
866   private native void _set_busy (long g)
867     throws LibGuestFSException;
868
869   /**
870    * set state to ready
871    * <p>
872    * This sets the state to "READY". This is only used when
873    * implementing actions using the low-level API.
874    * <p>
875    * For more information on states, see guestfs(3).
876    * <p>
877    * @throws LibGuestFSException
878    */
879   public void set_ready ()
880     throws LibGuestFSException
881   {
882     if (g == 0)
883       throw new LibGuestFSException ("set_ready: handle is closed");
884     _set_ready (g);
885   }
886   private native void _set_ready (long g)
887     throws LibGuestFSException;
888
889   /**
890    * leave the busy state
891    * <p>
892    * This sets the state to "READY", or if in "CONFIG" then
893    * it leaves the state as is. This is only used when
894    * implementing actions using the low-level API.
895    * <p>
896    * For more information on states, see guestfs(3).
897    * <p>
898    * @throws LibGuestFSException
899    */
900   public void end_busy ()
901     throws LibGuestFSException
902   {
903     if (g == 0)
904       throw new LibGuestFSException ("end_busy: handle is closed");
905     _end_busy (g);
906   }
907   private native void _end_busy (long g)
908     throws LibGuestFSException;
909
910   /**
911    * mount a guest disk at a position in the filesystem
912    * <p>
913    * Mount a guest disk at a position in the filesystem.
914    * Block devices are named "/dev/sda", "/dev/sdb" and so
915    * on, as they were added to the guest. If those block
916    * devices contain partitions, they will have the usual
917    * names (eg. "/dev/sda1"). Also LVM "/dev/VG/LV"-style
918    * names can be used.
919    * <p>
920    * The rules are the same as for mount(2): A filesystem
921    * must first be mounted on "/" before others can be
922    * mounted. Other filesystems can only be mounted on
923    * directories which already exist.
924    * <p>
925    * The mounted filesystem is writable, if we have
926    * sufficient permissions on the underlying device.
927    * <p>
928    * The filesystem options "sync" and "noatime" are set with
929    * this call, in order to improve reliability.
930    * <p>
931    * @throws LibGuestFSException
932    */
933   public void mount (String device, String mountpoint)
934     throws LibGuestFSException
935   {
936     if (g == 0)
937       throw new LibGuestFSException ("mount: handle is closed");
938     _mount (g, device, mountpoint);
939   }
940   private native void _mount (long g, String device, String mountpoint)
941     throws LibGuestFSException;
942
943   /**
944    * sync disks, writes are flushed through to the disk image
945    * <p>
946    * This syncs the disk, so that any writes are flushed
947    * through to the underlying disk image.
948    * <p>
949    * You should always call this if you have modified a disk
950    * image, before closing the handle.
951    * <p>
952    * @throws LibGuestFSException
953    */
954   public void sync ()
955     throws LibGuestFSException
956   {
957     if (g == 0)
958       throw new LibGuestFSException ("sync: handle is closed");
959     _sync (g);
960   }
961   private native void _sync (long g)
962     throws LibGuestFSException;
963
964   /**
965    * update file timestamps or create a new file
966    * <p>
967    * Touch acts like the touch(1) command. It can be used to
968    * update the timestamps on a file, or, if the file does
969    * not exist, to create a new zero-length file.
970    * <p>
971    * @throws LibGuestFSException
972    */
973   public void touch (String path)
974     throws LibGuestFSException
975   {
976     if (g == 0)
977       throw new LibGuestFSException ("touch: handle is closed");
978     _touch (g, path);
979   }
980   private native void _touch (long g, String path)
981     throws LibGuestFSException;
982
983   /**
984    * list the contents of a file
985    * <p>
986    * Return the contents of the file named "path".
987    * <p>
988    * Note that this function cannot correctly handle binary
989    * files (specifically, files containing "\0" character
990    * which is treated as end of string). For those you need
991    * to use the "g.download" function which has a more
992    * complex interface.
993    * <p>
994    * Because of the message protocol, there is a transfer
995    * limit of somewhere between 2MB and 4MB. To transfer
996    * large files you should use FTP.
997    * <p>
998    * @throws LibGuestFSException
999    */
1000   public String cat (String path)
1001     throws LibGuestFSException
1002   {
1003     if (g == 0)
1004       throw new LibGuestFSException ("cat: handle is closed");
1005     return _cat (g, path);
1006   }
1007   private native String _cat (long g, String path)
1008     throws LibGuestFSException;
1009
1010   /**
1011    * list the files in a directory (long format)
1012    * <p>
1013    * List the files in "directory" (relative to the root
1014    * directory, there is no cwd) in the format of 'ls -la'.
1015    * <p>
1016    * This command is mostly useful for interactive sessions.
1017    * It is *not* intended that you try to parse the output
1018    * string.
1019    * <p>
1020    * @throws LibGuestFSException
1021    */
1022   public String ll (String directory)
1023     throws LibGuestFSException
1024   {
1025     if (g == 0)
1026       throw new LibGuestFSException ("ll: handle is closed");
1027     return _ll (g, directory);
1028   }
1029   private native String _ll (long g, String directory)
1030     throws LibGuestFSException;
1031
1032   /**
1033    * list the files in a directory
1034    * <p>
1035    * List the files in "directory" (relative to the root
1036    * directory, there is no cwd). The '.' and '..' entries
1037    * are not returned, but hidden files are shown.
1038    * <p>
1039    * This command is mostly useful for interactive sessions.
1040    * Programs should probably use "g.readdir" instead.
1041    * <p>
1042    * @throws LibGuestFSException
1043    */
1044   public String[] ls (String directory)
1045     throws LibGuestFSException
1046   {
1047     if (g == 0)
1048       throw new LibGuestFSException ("ls: handle is closed");
1049     return _ls (g, directory);
1050   }
1051   private native String[] _ls (long g, String directory)
1052     throws LibGuestFSException;
1053
1054   /**
1055    * list the block devices
1056    * <p>
1057    * List all the block devices.
1058    * <p>
1059    * The full block device names are returned, eg. "/dev/sda"
1060    * <p>
1061    * @throws LibGuestFSException
1062    */
1063   public String[] list_devices ()
1064     throws LibGuestFSException
1065   {
1066     if (g == 0)
1067       throw new LibGuestFSException ("list_devices: handle is closed");
1068     return _list_devices (g);
1069   }
1070   private native String[] _list_devices (long g)
1071     throws LibGuestFSException;
1072
1073   /**
1074    * list the partitions
1075    * <p>
1076    * List all the partitions detected on all block devices.
1077    * <p>
1078    * The full partition device names are returned, eg.
1079    * "/dev/sda1"
1080    * <p>
1081    * This does not return logical volumes. For that you will
1082    * need to call "g.lvs".
1083    * <p>
1084    * @throws LibGuestFSException
1085    */
1086   public String[] list_partitions ()
1087     throws LibGuestFSException
1088   {
1089     if (g == 0)
1090       throw new LibGuestFSException ("list_partitions: handle is closed");
1091     return _list_partitions (g);
1092   }
1093   private native String[] _list_partitions (long g)
1094     throws LibGuestFSException;
1095
1096   /**
1097    * list the LVM physical volumes (PVs)
1098    * <p>
1099    * List all the physical volumes detected. This is the
1100    * equivalent of the pvs(8) command.
1101    * <p>
1102    * This returns a list of just the device names that
1103    * contain PVs (eg. "/dev/sda2").
1104    * <p>
1105    * See also "g.pvs_full".
1106    * <p>
1107    * @throws LibGuestFSException
1108    */
1109   public String[] pvs ()
1110     throws LibGuestFSException
1111   {
1112     if (g == 0)
1113       throw new LibGuestFSException ("pvs: handle is closed");
1114     return _pvs (g);
1115   }
1116   private native String[] _pvs (long g)
1117     throws LibGuestFSException;
1118
1119   /**
1120    * list the LVM volume groups (VGs)
1121    * <p>
1122    * List all the volumes groups detected. This is the
1123    * equivalent of the vgs(8) command.
1124    * <p>
1125    * This returns a list of just the volume group names that
1126    * were detected (eg. "VolGroup00").
1127    * <p>
1128    * See also "g.vgs_full".
1129    * <p>
1130    * @throws LibGuestFSException
1131    */
1132   public String[] vgs ()
1133     throws LibGuestFSException
1134   {
1135     if (g == 0)
1136       throw new LibGuestFSException ("vgs: handle is closed");
1137     return _vgs (g);
1138   }
1139   private native String[] _vgs (long g)
1140     throws LibGuestFSException;
1141
1142   /**
1143    * list the LVM logical volumes (LVs)
1144    * <p>
1145    * List all the logical volumes detected. This is the
1146    * equivalent of the lvs(8) command.
1147    * <p>
1148    * This returns a list of the logical volume device names
1149    * (eg. "/dev/VolGroup00/LogVol00").
1150    * <p>
1151    * See also "g.lvs_full".
1152    * <p>
1153    * @throws LibGuestFSException
1154    */
1155   public String[] lvs ()
1156     throws LibGuestFSException
1157   {
1158     if (g == 0)
1159       throw new LibGuestFSException ("lvs: handle is closed");
1160     return _lvs (g);
1161   }
1162   private native String[] _lvs (long g)
1163     throws LibGuestFSException;
1164
1165   /**
1166    * list the LVM physical volumes (PVs)
1167    * <p>
1168    * List all the physical volumes detected. This is the
1169    * equivalent of the pvs(8) command. The "full" version
1170    * includes all fields.
1171    * <p>
1172    * @throws LibGuestFSException
1173    */
1174   public PV[] pvs_full ()
1175     throws LibGuestFSException
1176   {
1177     if (g == 0)
1178       throw new LibGuestFSException ("pvs_full: handle is closed");
1179     return _pvs_full (g);
1180   }
1181   private native PV[] _pvs_full (long g)
1182     throws LibGuestFSException;
1183
1184   /**
1185    * list the LVM volume groups (VGs)
1186    * <p>
1187    * List all the volumes groups detected. This is the
1188    * equivalent of the vgs(8) command. The "full" version
1189    * includes all fields.
1190    * <p>
1191    * @throws LibGuestFSException
1192    */
1193   public VG[] vgs_full ()
1194     throws LibGuestFSException
1195   {
1196     if (g == 0)
1197       throw new LibGuestFSException ("vgs_full: handle is closed");
1198     return _vgs_full (g);
1199   }
1200   private native VG[] _vgs_full (long g)
1201     throws LibGuestFSException;
1202
1203   /**
1204    * list the LVM logical volumes (LVs)
1205    * <p>
1206    * List all the logical volumes detected. This is the
1207    * equivalent of the lvs(8) command. The "full" version
1208    * includes all fields.
1209    * <p>
1210    * @throws LibGuestFSException
1211    */
1212   public LV[] lvs_full ()
1213     throws LibGuestFSException
1214   {
1215     if (g == 0)
1216       throw new LibGuestFSException ("lvs_full: handle is closed");
1217     return _lvs_full (g);
1218   }
1219   private native LV[] _lvs_full (long g)
1220     throws LibGuestFSException;
1221
1222   /**
1223    * read file as lines
1224    * <p>
1225    * Return the contents of the file named "path".
1226    * <p>
1227    * The file contents are returned as a list of lines.
1228    * Trailing "LF" and "CRLF" character sequences are *not*
1229    * returned.
1230    * <p>
1231    * Note that this function cannot correctly handle binary
1232    * files (specifically, files containing "\0" character
1233    * which is treated as end of line). For those you need to
1234    * use the "g.read_file" function which has a more complex
1235    * interface.
1236    * <p>
1237    * @throws LibGuestFSException
1238    */
1239   public String[] read_lines (String path)
1240     throws LibGuestFSException
1241   {
1242     if (g == 0)
1243       throw new LibGuestFSException ("read_lines: handle is closed");
1244     return _read_lines (g, path);
1245   }
1246   private native String[] _read_lines (long g, String path)
1247     throws LibGuestFSException;
1248
1249   /**
1250    * create a new Augeas handle
1251    * <p>
1252    * Create a new Augeas handle for editing configuration
1253    * files. If there was any previous Augeas handle
1254    * associated with this guestfs session, then it is closed.
1255    * <p>
1256    * You must call this before using any other "g.aug_*"
1257    * commands.
1258    * <p>
1259    * "root" is the filesystem root. "root" must not be NULL,
1260    * use "/" instead.
1261    * <p>
1262    * The flags are the same as the flags defined in
1263    * <augeas.h>, the logical *or* of the following integers:
1264    * <p>
1265    * "AUG_SAVE_BACKUP" = 1
1266    * Keep the original file with a ".augsave" extension.
1267    * <p>
1268    * "AUG_SAVE_NEWFILE" = 2
1269    * Save changes into a file with extension ".augnew",
1270    * and do not overwrite original. Overrides
1271    * "AUG_SAVE_BACKUP".
1272    * <p>
1273    * "AUG_TYPE_CHECK" = 4
1274    * Typecheck lenses (can be expensive).
1275    * <p>
1276    * "AUG_NO_STDINC" = 8
1277    * Do not use standard load path for modules.
1278    * <p>
1279    * "AUG_SAVE_NOOP" = 16
1280    * Make save a no-op, just record what would have been
1281    * changed.
1282    * <p>
1283    * "AUG_NO_LOAD" = 32
1284    * Do not load the tree in "g.aug_init".
1285    * <p>
1286    * To close the handle, you can call "g.aug_close".
1287    * <p>
1288    * To find out more about Augeas, see <http://augeas.net/>.
1289    * <p>
1290    * @throws LibGuestFSException
1291    */
1292   public void aug_init (String root, int flags)
1293     throws LibGuestFSException
1294   {
1295     if (g == 0)
1296       throw new LibGuestFSException ("aug_init: handle is closed");
1297     _aug_init (g, root, flags);
1298   }
1299   private native void _aug_init (long g, String root, int flags)
1300     throws LibGuestFSException;
1301
1302   /**
1303    * close the current Augeas handle
1304    * <p>
1305    * Close the current Augeas handle and free up any
1306    * resources used by it. After calling this, you have to
1307    * call "g.aug_init" again before you can use any other
1308    * Augeas functions.
1309    * <p>
1310    * @throws LibGuestFSException
1311    */
1312   public void aug_close ()
1313     throws LibGuestFSException
1314   {
1315     if (g == 0)
1316       throw new LibGuestFSException ("aug_close: handle is closed");
1317     _aug_close (g);
1318   }
1319   private native void _aug_close (long g)
1320     throws LibGuestFSException;
1321
1322   /**
1323    * define an Augeas variable
1324    * <p>
1325    * Defines an Augeas variable "name" whose value is the
1326    * result of evaluating "expr". If "expr" is NULL, then
1327    * "name" is undefined.
1328    * <p>
1329    * On success this returns the number of nodes in "expr",
1330    * or 0 if "expr" evaluates to something which is not a
1331    * nodeset.
1332    * <p>
1333    * @throws LibGuestFSException
1334    */
1335   public int aug_defvar (String name, String expr)
1336     throws LibGuestFSException
1337   {
1338     if (g == 0)
1339       throw new LibGuestFSException ("aug_defvar: handle is closed");
1340     return _aug_defvar (g, name, expr);
1341   }
1342   private native int _aug_defvar (long g, String name, String expr)
1343     throws LibGuestFSException;
1344
1345   /**
1346    * define an Augeas node
1347    * <p>
1348    * Defines a variable "name" whose value is the result of
1349    * evaluating "expr".
1350    * <p>
1351    * If "expr" evaluates to an empty nodeset, a node is
1352    * created, equivalent to calling "g.aug_set" "expr",
1353    * "value". "name" will be the nodeset containing that
1354    * single node.
1355    * <p>
1356    * On success this returns a pair containing the number of
1357    * nodes in the nodeset, and a boolean flag if a node was
1358    * created.
1359    * <p>
1360    * @throws LibGuestFSException
1361    */
1362   public IntBool aug_defnode (String name, String expr, String val)
1363     throws LibGuestFSException
1364   {
1365     if (g == 0)
1366       throw new LibGuestFSException ("aug_defnode: handle is closed");
1367     return _aug_defnode (g, name, expr, val);
1368   }
1369   private native IntBool _aug_defnode (long g, String name, String expr, String val)
1370     throws LibGuestFSException;
1371
1372   /**
1373    * look up the value of an Augeas path
1374    * <p>
1375    * Look up the value associated with "path". If "path"
1376    * matches exactly one node, the "value" is returned.
1377    * <p>
1378    * @throws LibGuestFSException
1379    */
1380   public String aug_get (String path)
1381     throws LibGuestFSException
1382   {
1383     if (g == 0)
1384       throw new LibGuestFSException ("aug_get: handle is closed");
1385     return _aug_get (g, path);
1386   }
1387   private native String _aug_get (long g, String path)
1388     throws LibGuestFSException;
1389
1390   /**
1391    * set Augeas path to value
1392    * <p>
1393    * Set the value associated with "path" to "value".
1394    * <p>
1395    * @throws LibGuestFSException
1396    */
1397   public void aug_set (String path, String val)
1398     throws LibGuestFSException
1399   {
1400     if (g == 0)
1401       throw new LibGuestFSException ("aug_set: handle is closed");
1402     _aug_set (g, path, val);
1403   }
1404   private native void _aug_set (long g, String path, String val)
1405     throws LibGuestFSException;
1406
1407   /**
1408    * insert a sibling Augeas node
1409    * <p>
1410    * Create a new sibling "label" for "path", inserting it
1411    * into the tree before or after "path" (depending on the
1412    * boolean flag "before").
1413    * <p>
1414    * "path" must match exactly one existing node in the tree,
1415    * and "label" must be a label, ie. not contain "/", "*" or
1416    * end with a bracketed index "[N]".
1417    * <p>
1418    * @throws LibGuestFSException
1419    */
1420   public void aug_insert (String path, String label, boolean before)
1421     throws LibGuestFSException
1422   {
1423     if (g == 0)
1424       throw new LibGuestFSException ("aug_insert: handle is closed");
1425     _aug_insert (g, path, label, before);
1426   }
1427   private native void _aug_insert (long g, String path, String label, boolean before)
1428     throws LibGuestFSException;
1429
1430   /**
1431    * remove an Augeas path
1432    * <p>
1433    * Remove "path" and all of its children.
1434    * <p>
1435    * On success this returns the number of entries which were
1436    * removed.
1437    * <p>
1438    * @throws LibGuestFSException
1439    */
1440   public int aug_rm (String path)
1441     throws LibGuestFSException
1442   {
1443     if (g == 0)
1444       throw new LibGuestFSException ("aug_rm: handle is closed");
1445     return _aug_rm (g, path);
1446   }
1447   private native int _aug_rm (long g, String path)
1448     throws LibGuestFSException;
1449
1450   /**
1451    * move Augeas node
1452    * <p>
1453    * Move the node "src" to "dest". "src" must match exactly
1454    * one node. "dest" is overwritten if it exists.
1455    * <p>
1456    * @throws LibGuestFSException
1457    */
1458   public void aug_mv (String src, String dest)
1459     throws LibGuestFSException
1460   {
1461     if (g == 0)
1462       throw new LibGuestFSException ("aug_mv: handle is closed");
1463     _aug_mv (g, src, dest);
1464   }
1465   private native void _aug_mv (long g, String src, String dest)
1466     throws LibGuestFSException;
1467
1468   /**
1469    * return Augeas nodes which match path
1470    * <p>
1471    * Returns a list of paths which match the path expression
1472    * "path". The returned paths are sufficiently qualified so
1473    * that they match exactly one node in the current tree.
1474    * <p>
1475    * @throws LibGuestFSException
1476    */
1477   public String[] aug_match (String path)
1478     throws LibGuestFSException
1479   {
1480     if (g == 0)
1481       throw new LibGuestFSException ("aug_match: handle is closed");
1482     return _aug_match (g, path);
1483   }
1484   private native String[] _aug_match (long g, String path)
1485     throws LibGuestFSException;
1486
1487   /**
1488    * write all pending Augeas changes to disk
1489    * <p>
1490    * This writes all pending changes to disk.
1491    * <p>
1492    * The flags which were passed to "g.aug_init" affect
1493    * exactly how files are saved.
1494    * <p>
1495    * @throws LibGuestFSException
1496    */
1497   public void aug_save ()
1498     throws LibGuestFSException
1499   {
1500     if (g == 0)
1501       throw new LibGuestFSException ("aug_save: handle is closed");
1502     _aug_save (g);
1503   }
1504   private native void _aug_save (long g)
1505     throws LibGuestFSException;
1506
1507   /**
1508    * load files into the tree
1509    * <p>
1510    * Load files into the tree.
1511    * <p>
1512    * See "aug_load" in the Augeas documentation for the full
1513    * gory details.
1514    * <p>
1515    * @throws LibGuestFSException
1516    */
1517   public void aug_load ()
1518     throws LibGuestFSException
1519   {
1520     if (g == 0)
1521       throw new LibGuestFSException ("aug_load: handle is closed");
1522     _aug_load (g);
1523   }
1524   private native void _aug_load (long g)
1525     throws LibGuestFSException;
1526
1527   /**
1528    * list Augeas nodes under a path
1529    * <p>
1530    * This is just a shortcut for listing "g.aug_match"
1531    * "path/*" and sorting the resulting nodes into
1532    * alphabetical order.
1533    * <p>
1534    * @throws LibGuestFSException
1535    */
1536   public String[] aug_ls (String path)
1537     throws LibGuestFSException
1538   {
1539     if (g == 0)
1540       throw new LibGuestFSException ("aug_ls: handle is closed");
1541     return _aug_ls (g, path);
1542   }
1543   private native String[] _aug_ls (long g, String path)
1544     throws LibGuestFSException;
1545
1546   /**
1547    * remove a file
1548    * <p>
1549    * Remove the single file "path".
1550    * <p>
1551    * @throws LibGuestFSException
1552    */
1553   public void rm (String path)
1554     throws LibGuestFSException
1555   {
1556     if (g == 0)
1557       throw new LibGuestFSException ("rm: handle is closed");
1558     _rm (g, path);
1559   }
1560   private native void _rm (long g, String path)
1561     throws LibGuestFSException;
1562
1563   /**
1564    * remove a directory
1565    * <p>
1566    * Remove the single directory "path".
1567    * <p>
1568    * @throws LibGuestFSException
1569    */
1570   public void rmdir (String path)
1571     throws LibGuestFSException
1572   {
1573     if (g == 0)
1574       throw new LibGuestFSException ("rmdir: handle is closed");
1575     _rmdir (g, path);
1576   }
1577   private native void _rmdir (long g, String path)
1578     throws LibGuestFSException;
1579
1580   /**
1581    * remove a file or directory recursively
1582    * <p>
1583    * Remove the file or directory "path", recursively
1584    * removing the contents if its a directory. This is like
1585    * the "rm -rf" shell command.
1586    * <p>
1587    * @throws LibGuestFSException
1588    */
1589   public void rm_rf (String path)
1590     throws LibGuestFSException
1591   {
1592     if (g == 0)
1593       throw new LibGuestFSException ("rm_rf: handle is closed");
1594     _rm_rf (g, path);
1595   }
1596   private native void _rm_rf (long g, String path)
1597     throws LibGuestFSException;
1598
1599   /**
1600    * create a directory
1601    * <p>
1602    * Create a directory named "path".
1603    * <p>
1604    * @throws LibGuestFSException
1605    */
1606   public void mkdir (String path)
1607     throws LibGuestFSException
1608   {
1609     if (g == 0)
1610       throw new LibGuestFSException ("mkdir: handle is closed");
1611     _mkdir (g, path);
1612   }
1613   private native void _mkdir (long g, String path)
1614     throws LibGuestFSException;
1615
1616   /**
1617    * create a directory and parents
1618    * <p>
1619    * Create a directory named "path", creating any parent
1620    * directories as necessary. This is like the "mkdir -p"
1621    * shell command.
1622    * <p>
1623    * @throws LibGuestFSException
1624    */
1625   public void mkdir_p (String path)
1626     throws LibGuestFSException
1627   {
1628     if (g == 0)
1629       throw new LibGuestFSException ("mkdir_p: handle is closed");
1630     _mkdir_p (g, path);
1631   }
1632   private native void _mkdir_p (long g, String path)
1633     throws LibGuestFSException;
1634
1635   /**
1636    * change file mode
1637    * <p>
1638    * Change the mode (permissions) of "path" to "mode". Only
1639    * numeric modes are supported.
1640    * <p>
1641    * @throws LibGuestFSException
1642    */
1643   public void chmod (int mode, String path)
1644     throws LibGuestFSException
1645   {
1646     if (g == 0)
1647       throw new LibGuestFSException ("chmod: handle is closed");
1648     _chmod (g, mode, path);
1649   }
1650   private native void _chmod (long g, int mode, String path)
1651     throws LibGuestFSException;
1652
1653   /**
1654    * change file owner and group
1655    * <p>
1656    * Change the file owner to "owner" and group to "group".
1657    * <p>
1658    * Only numeric uid and gid are supported. If you want to
1659    * use names, you will need to locate and parse the
1660    * password file yourself (Augeas support makes this
1661    * relatively easy).
1662    * <p>
1663    * @throws LibGuestFSException
1664    */
1665   public void chown (int owner, int group, String path)
1666     throws LibGuestFSException
1667   {
1668     if (g == 0)
1669       throw new LibGuestFSException ("chown: handle is closed");
1670     _chown (g, owner, group, path);
1671   }
1672   private native void _chown (long g, int owner, int group, String path)
1673     throws LibGuestFSException;
1674
1675   /**
1676    * test if file or directory exists
1677    * <p>
1678    * This returns "true" if and only if there is a file,
1679    * directory (or anything) with the given "path" name.
1680    * <p>
1681    * See also "g.is_file", "g.is_dir", "g.stat".
1682    * <p>
1683    * @throws LibGuestFSException
1684    */
1685   public boolean exists (String path)
1686     throws LibGuestFSException
1687   {
1688     if (g == 0)
1689       throw new LibGuestFSException ("exists: handle is closed");
1690     return _exists (g, path);
1691   }
1692   private native boolean _exists (long g, String path)
1693     throws LibGuestFSException;
1694
1695   /**
1696    * test if file exists
1697    * <p>
1698    * This returns "true" if and only if there is a file with
1699    * the given "path" name. Note that it returns false for
1700    * other objects like directories.
1701    * <p>
1702    * See also "g.stat".
1703    * <p>
1704    * @throws LibGuestFSException
1705    */
1706   public boolean is_file (String path)
1707     throws LibGuestFSException
1708   {
1709     if (g == 0)
1710       throw new LibGuestFSException ("is_file: handle is closed");
1711     return _is_file (g, path);
1712   }
1713   private native boolean _is_file (long g, String path)
1714     throws LibGuestFSException;
1715
1716   /**
1717    * test if file exists
1718    * <p>
1719    * This returns "true" if and only if there is a directory
1720    * with the given "path" name. Note that it returns false
1721    * for other objects like files.
1722    * <p>
1723    * See also "g.stat".
1724    * <p>
1725    * @throws LibGuestFSException
1726    */
1727   public boolean is_dir (String path)
1728     throws LibGuestFSException
1729   {
1730     if (g == 0)
1731       throw new LibGuestFSException ("is_dir: handle is closed");
1732     return _is_dir (g, path);
1733   }
1734   private native boolean _is_dir (long g, String path)
1735     throws LibGuestFSException;
1736
1737   /**
1738    * create an LVM physical volume
1739    * <p>
1740    * This creates an LVM physical volume on the named
1741    * "device", where "device" should usually be a partition
1742    * name such as "/dev/sda1".
1743    * <p>
1744    * @throws LibGuestFSException
1745    */
1746   public void pvcreate (String device)
1747     throws LibGuestFSException
1748   {
1749     if (g == 0)
1750       throw new LibGuestFSException ("pvcreate: handle is closed");
1751     _pvcreate (g, device);
1752   }
1753   private native void _pvcreate (long g, String device)
1754     throws LibGuestFSException;
1755
1756   /**
1757    * create an LVM volume group
1758    * <p>
1759    * This creates an LVM volume group called "volgroup" from
1760    * the non-empty list of physical volumes "physvols".
1761    * <p>
1762    * @throws LibGuestFSException
1763    */
1764   public void vgcreate (String volgroup, String[] physvols)
1765     throws LibGuestFSException
1766   {
1767     if (g == 0)
1768       throw new LibGuestFSException ("vgcreate: handle is closed");
1769     _vgcreate (g, volgroup, physvols);
1770   }
1771   private native void _vgcreate (long g, String volgroup, String[] physvols)
1772     throws LibGuestFSException;
1773
1774   /**
1775    * create an LVM volume group
1776    * <p>
1777    * This creates an LVM volume group called "logvol" on the
1778    * volume group "volgroup", with "size" megabytes.
1779    * <p>
1780    * @throws LibGuestFSException
1781    */
1782   public void lvcreate (String logvol, String volgroup, int mbytes)
1783     throws LibGuestFSException
1784   {
1785     if (g == 0)
1786       throw new LibGuestFSException ("lvcreate: handle is closed");
1787     _lvcreate (g, logvol, volgroup, mbytes);
1788   }
1789   private native void _lvcreate (long g, String logvol, String volgroup, int mbytes)
1790     throws LibGuestFSException;
1791
1792   /**
1793    * make a filesystem
1794    * <p>
1795    * This creates a filesystem on "device" (usually a
1796    * partition or LVM logical volume). The filesystem type is
1797    * "fstype", for example "ext3".
1798    * <p>
1799    * @throws LibGuestFSException
1800    */
1801   public void mkfs (String fstype, String device)
1802     throws LibGuestFSException
1803   {
1804     if (g == 0)
1805       throw new LibGuestFSException ("mkfs: handle is closed");
1806     _mkfs (g, fstype, device);
1807   }
1808   private native void _mkfs (long g, String fstype, String device)
1809     throws LibGuestFSException;
1810
1811   /**
1812    * create partitions on a block device
1813    * <p>
1814    * This is a direct interface to the sfdisk(8) program for
1815    * creating partitions on block devices.
1816    * <p>
1817    * "device" should be a block device, for example
1818    * "/dev/sda".
1819    * <p>
1820    * "cyls", "heads" and "sectors" are the number of
1821    * cylinders, heads and sectors on the device, which are
1822    * passed directly to sfdisk as the *-C*, *-H* and *-S*
1823    * parameters. If you pass 0 for any of these, then the
1824    * corresponding parameter is omitted. Usually for 'large'
1825    * disks, you can just pass 0 for these, but for small
1826    * (floppy-sized) disks, sfdisk (or rather, the kernel)
1827    * cannot work out the right geometry and you will need to
1828    * tell it.
1829    * <p>
1830    * "lines" is a list of lines that we feed to "sfdisk". For
1831    * more information refer to the sfdisk(8) manpage.
1832    * <p>
1833    * To create a single partition occupying the whole disk,
1834    * you would pass "lines" as a single element list, when
1835    * the single element being the string "," (comma).
1836    * <p>
1837    * See also: "g.sfdisk_l", "g.sfdisk_N"
1838    * <p>
1839    * This command is dangerous. Without careful use you can
1840    * easily destroy all your data.
1841    * <p>
1842    * @throws LibGuestFSException
1843    */
1844   public void sfdisk (String device, int cyls, int heads, int sectors, String[] lines)
1845     throws LibGuestFSException
1846   {
1847     if (g == 0)
1848       throw new LibGuestFSException ("sfdisk: handle is closed");
1849     _sfdisk (g, device, cyls, heads, sectors, lines);
1850   }
1851   private native void _sfdisk (long g, String device, int cyls, int heads, int sectors, String[] lines)
1852     throws LibGuestFSException;
1853
1854   /**
1855    * create a file
1856    * <p>
1857    * This call creates a file called "path". The contents of
1858    * the file is the string "content" (which can contain any
1859    * 8 bit data), with length "size".
1860    * <p>
1861    * As a special case, if "size" is 0 then the length is
1862    * calculated using "strlen" (so in this case the content
1863    * cannot contain embedded ASCII NULs).
1864    * <p>
1865    * *NB.* Owing to a bug, writing content containing ASCII
1866    * NUL characters does *not* work, even if the length is
1867    * specified. We hope to resolve this bug in a future
1868    * version. In the meantime use "g.upload".
1869    * <p>
1870    * Because of the message protocol, there is a transfer
1871    * limit of somewhere between 2MB and 4MB. To transfer
1872    * large files you should use FTP.
1873    * <p>
1874    * @throws LibGuestFSException
1875    */
1876   public void write_file (String path, String content, int size)
1877     throws LibGuestFSException
1878   {
1879     if (g == 0)
1880       throw new LibGuestFSException ("write_file: handle is closed");
1881     _write_file (g, path, content, size);
1882   }
1883   private native void _write_file (long g, String path, String content, int size)
1884     throws LibGuestFSException;
1885
1886   /**
1887    * unmount a filesystem
1888    * <p>
1889    * This unmounts the given filesystem. The filesystem may
1890    * be specified either by its mountpoint (path) or the
1891    * device which contains the filesystem.
1892    * <p>
1893    * @throws LibGuestFSException
1894    */
1895   public void umount (String pathordevice)
1896     throws LibGuestFSException
1897   {
1898     if (g == 0)
1899       throw new LibGuestFSException ("umount: handle is closed");
1900     _umount (g, pathordevice);
1901   }
1902   private native void _umount (long g, String pathordevice)
1903     throws LibGuestFSException;
1904
1905   /**
1906    * show mounted filesystems
1907    * <p>
1908    * This returns the list of currently mounted filesystems.
1909    * It returns the list of devices (eg. "/dev/sda1",
1910    * "/dev/VG/LV").
1911    * <p>
1912    * Some internal mounts are not shown.
1913    * <p>
1914    * @throws LibGuestFSException
1915    */
1916   public String[] mounts ()
1917     throws LibGuestFSException
1918   {
1919     if (g == 0)
1920       throw new LibGuestFSException ("mounts: handle is closed");
1921     return _mounts (g);
1922   }
1923   private native String[] _mounts (long g)
1924     throws LibGuestFSException;
1925
1926   /**
1927    * unmount all filesystems
1928    * <p>
1929    * This unmounts all mounted filesystems.
1930    * <p>
1931    * Some internal mounts are not unmounted by this call.
1932    * <p>
1933    * @throws LibGuestFSException
1934    */
1935   public void umount_all ()
1936     throws LibGuestFSException
1937   {
1938     if (g == 0)
1939       throw new LibGuestFSException ("umount_all: handle is closed");
1940     _umount_all (g);
1941   }
1942   private native void _umount_all (long g)
1943     throws LibGuestFSException;
1944
1945   /**
1946    * remove all LVM LVs, VGs and PVs
1947    * <p>
1948    * This command removes all LVM logical volumes, volume
1949    * groups and physical volumes.
1950    * <p>
1951    * This command is dangerous. Without careful use you can
1952    * easily destroy all your data.
1953    * <p>
1954    * @throws LibGuestFSException
1955    */
1956   public void lvm_remove_all ()
1957     throws LibGuestFSException
1958   {
1959     if (g == 0)
1960       throw new LibGuestFSException ("lvm_remove_all: handle is closed");
1961     _lvm_remove_all (g);
1962   }
1963   private native void _lvm_remove_all (long g)
1964     throws LibGuestFSException;
1965
1966   /**
1967    * determine file type
1968    * <p>
1969    * This call uses the standard file(1) command to determine
1970    * the type or contents of the file. This also works on
1971    * devices, for example to find out whether a partition
1972    * contains a filesystem.
1973    * <p>
1974    * The exact command which runs is "file -bsL path". Note
1975    * in particular that the filename is not prepended to the
1976    * output (the "-b" option).
1977    * <p>
1978    * @throws LibGuestFSException
1979    */
1980   public String file (String path)
1981     throws LibGuestFSException
1982   {
1983     if (g == 0)
1984       throw new LibGuestFSException ("file: handle is closed");
1985     return _file (g, path);
1986   }
1987   private native String _file (long g, String path)
1988     throws LibGuestFSException;
1989
1990   /**
1991    * run a command from the guest filesystem
1992    * <p>
1993    * This call runs a command from the guest filesystem. The
1994    * filesystem must be mounted, and must contain a
1995    * compatible operating system (ie. something Linux, with
1996    * the same or compatible processor architecture).
1997    * <p>
1998    * The single parameter is an argv-style list of arguments.
1999    * The first element is the name of the program to run.
2000    * Subsequent elements are parameters. The list must be
2001    * non-empty (ie. must contain a program name).
2002    * <p>
2003    * The return value is anything printed to *stdout* by the
2004    * command.
2005    * <p>
2006    * If the command returns a non-zero exit status, then this
2007    * function returns an error message. The error message
2008    * string is the content of *stderr* from the command.
2009    * <p>
2010    * The $PATH environment variable will contain at least
2011    * "/usr/bin" and "/bin". If you require a program from
2012    * another location, you should provide the full path in
2013    * the first parameter.
2014    * <p>
2015    * Shared libraries and data files required by the program
2016    * must be available on filesystems which are mounted in
2017    * the correct places. It is the caller's responsibility to
2018    * ensure all filesystems that are needed are mounted at
2019    * the right locations.
2020    * <p>
2021    * Because of the message protocol, there is a transfer
2022    * limit of somewhere between 2MB and 4MB. To transfer
2023    * large files you should use FTP.
2024    * <p>
2025    * @throws LibGuestFSException
2026    */
2027   public String command (String[] arguments)
2028     throws LibGuestFSException
2029   {
2030     if (g == 0)
2031       throw new LibGuestFSException ("command: handle is closed");
2032     return _command (g, arguments);
2033   }
2034   private native String _command (long g, String[] arguments)
2035     throws LibGuestFSException;
2036
2037   /**
2038    * run a command, returning lines
2039    * <p>
2040    * This is the same as "g.command", but splits the result
2041    * into a list of lines.
2042    * <p>
2043    * Because of the message protocol, there is a transfer
2044    * limit of somewhere between 2MB and 4MB. To transfer
2045    * large files you should use FTP.
2046    * <p>
2047    * @throws LibGuestFSException
2048    */
2049   public String[] command_lines (String[] arguments)
2050     throws LibGuestFSException
2051   {
2052     if (g == 0)
2053       throw new LibGuestFSException ("command_lines: handle is closed");
2054     return _command_lines (g, arguments);
2055   }
2056   private native String[] _command_lines (long g, String[] arguments)
2057     throws LibGuestFSException;
2058
2059   /**
2060    * get file information
2061    * <p>
2062    * Returns file information for the given "path".
2063    * <p>
2064    * This is the same as the stat(2) system call.
2065    * <p>
2066    * @throws LibGuestFSException
2067    */
2068   public Stat stat (String path)
2069     throws LibGuestFSException
2070   {
2071     if (g == 0)
2072       throw new LibGuestFSException ("stat: handle is closed");
2073     return _stat (g, path);
2074   }
2075   private native Stat _stat (long g, String path)
2076     throws LibGuestFSException;
2077
2078   /**
2079    * get file information for a symbolic link
2080    * <p>
2081    * Returns file information for the given "path".
2082    * <p>
2083    * This is the same as "g.stat" except that if "path" is a
2084    * symbolic link, then the link is stat-ed, not the file it
2085    * refers to.
2086    * <p>
2087    * This is the same as the lstat(2) system call.
2088    * <p>
2089    * @throws LibGuestFSException
2090    */
2091   public Stat lstat (String path)
2092     throws LibGuestFSException
2093   {
2094     if (g == 0)
2095       throw new LibGuestFSException ("lstat: handle is closed");
2096     return _lstat (g, path);
2097   }
2098   private native Stat _lstat (long g, String path)
2099     throws LibGuestFSException;
2100
2101   /**
2102    * get file system statistics
2103    * <p>
2104    * Returns file system statistics for any mounted file
2105    * system. "path" should be a file or directory in the
2106    * mounted file system (typically it is the mount point
2107    * itself, but it doesn't need to be).
2108    * <p>
2109    * This is the same as the statvfs(2) system call.
2110    * <p>
2111    * @throws LibGuestFSException
2112    */
2113   public StatVFS statvfs (String path)
2114     throws LibGuestFSException
2115   {
2116     if (g == 0)
2117       throw new LibGuestFSException ("statvfs: handle is closed");
2118     return _statvfs (g, path);
2119   }
2120   private native StatVFS _statvfs (long g, String path)
2121     throws LibGuestFSException;
2122
2123   /**
2124    * get ext2/ext3/ext4 superblock details
2125    * <p>
2126    * This returns the contents of the ext2, ext3 or ext4
2127    * filesystem superblock on "device".
2128    * <p>
2129    * It is the same as running "tune2fs -l device". See
2130    * tune2fs(8) manpage for more details. The list of fields
2131    * returned isn't clearly defined, and depends on both the
2132    * version of "tune2fs" that libguestfs was built against,
2133    * and the filesystem itself.
2134    * <p>
2135    * @throws LibGuestFSException
2136    */
2137   public HashMap<String,String> tune2fs_l (String device)
2138     throws LibGuestFSException
2139   {
2140     if (g == 0)
2141       throw new LibGuestFSException ("tune2fs_l: handle is closed");
2142     return _tune2fs_l (g, device);
2143   }
2144   private native HashMap<String,String> _tune2fs_l (long g, String device)
2145     throws LibGuestFSException;
2146
2147   /**
2148    * set block device to read-only
2149    * <p>
2150    * Sets the block device named "device" to read-only.
2151    * <p>
2152    * This uses the blockdev(8) command.
2153    * <p>
2154    * @throws LibGuestFSException
2155    */
2156   public void blockdev_setro (String device)
2157     throws LibGuestFSException
2158   {
2159     if (g == 0)
2160       throw new LibGuestFSException ("blockdev_setro: handle is closed");
2161     _blockdev_setro (g, device);
2162   }
2163   private native void _blockdev_setro (long g, String device)
2164     throws LibGuestFSException;
2165
2166   /**
2167    * set block device to read-write
2168    * <p>
2169    * Sets the block device named "device" to read-write.
2170    * <p>
2171    * This uses the blockdev(8) command.
2172    * <p>
2173    * @throws LibGuestFSException
2174    */
2175   public void blockdev_setrw (String device)
2176     throws LibGuestFSException
2177   {
2178     if (g == 0)
2179       throw new LibGuestFSException ("blockdev_setrw: handle is closed");
2180     _blockdev_setrw (g, device);
2181   }
2182   private native void _blockdev_setrw (long g, String device)
2183     throws LibGuestFSException;
2184
2185   /**
2186    * is block device set to read-only
2187    * <p>
2188    * Returns a boolean indicating if the block device is
2189    * read-only (true if read-only, false if not).
2190    * <p>
2191    * This uses the blockdev(8) command.
2192    * <p>
2193    * @throws LibGuestFSException
2194    */
2195   public boolean blockdev_getro (String device)
2196     throws LibGuestFSException
2197   {
2198     if (g == 0)
2199       throw new LibGuestFSException ("blockdev_getro: handle is closed");
2200     return _blockdev_getro (g, device);
2201   }
2202   private native boolean _blockdev_getro (long g, String device)
2203     throws LibGuestFSException;
2204
2205   /**
2206    * get sectorsize of block device
2207    * <p>
2208    * This returns the size of sectors on a block device.
2209    * Usually 512, but can be larger for modern devices.
2210    * <p>
2211    * (Note, this is not the size in sectors, use
2212    * "g.blockdev_getsz" for that).
2213    * <p>
2214    * This uses the blockdev(8) command.
2215    * <p>
2216    * @throws LibGuestFSException
2217    */
2218   public int blockdev_getss (String device)
2219     throws LibGuestFSException
2220   {
2221     if (g == 0)
2222       throw new LibGuestFSException ("blockdev_getss: handle is closed");
2223     return _blockdev_getss (g, device);
2224   }
2225   private native int _blockdev_getss (long g, String device)
2226     throws LibGuestFSException;
2227
2228   /**
2229    * get blocksize of block device
2230    * <p>
2231    * This returns the block size of a device.
2232    * <p>
2233    * (Note this is different from both *size in blocks* and
2234    * *filesystem block size*).
2235    * <p>
2236    * This uses the blockdev(8) command.
2237    * <p>
2238    * @throws LibGuestFSException
2239    */
2240   public int blockdev_getbsz (String device)
2241     throws LibGuestFSException
2242   {
2243     if (g == 0)
2244       throw new LibGuestFSException ("blockdev_getbsz: handle is closed");
2245     return _blockdev_getbsz (g, device);
2246   }
2247   private native int _blockdev_getbsz (long g, String device)
2248     throws LibGuestFSException;
2249
2250   /**
2251    * set blocksize of block device
2252    * <p>
2253    * This sets the block size of a device.
2254    * <p>
2255    * (Note this is different from both *size in blocks* and
2256    * *filesystem block size*).
2257    * <p>
2258    * This uses the blockdev(8) command.
2259    * <p>
2260    * @throws LibGuestFSException
2261    */
2262   public void blockdev_setbsz (String device, int blocksize)
2263     throws LibGuestFSException
2264   {
2265     if (g == 0)
2266       throw new LibGuestFSException ("blockdev_setbsz: handle is closed");
2267     _blockdev_setbsz (g, device, blocksize);
2268   }
2269   private native void _blockdev_setbsz (long g, String device, int blocksize)
2270     throws LibGuestFSException;
2271
2272   /**
2273    * get total size of device in 512-byte sectors
2274    * <p>
2275    * This returns the size of the device in units of 512-byte
2276    * sectors (even if the sectorsize isn't 512 bytes ...
2277    * weird).
2278    * <p>
2279    * See also "g.blockdev_getss" for the real sector size of
2280    * the device, and "g.blockdev_getsize64" for the more
2281    * useful *size in bytes*.
2282    * <p>
2283    * This uses the blockdev(8) command.
2284    * <p>
2285    * @throws LibGuestFSException
2286    */
2287   public long blockdev_getsz (String device)
2288     throws LibGuestFSException
2289   {
2290     if (g == 0)
2291       throw new LibGuestFSException ("blockdev_getsz: handle is closed");
2292     return _blockdev_getsz (g, device);
2293   }
2294   private native long _blockdev_getsz (long g, String device)
2295     throws LibGuestFSException;
2296
2297   /**
2298    * get total size of device in bytes
2299    * <p>
2300    * This returns the size of the device in bytes.
2301    * <p>
2302    * See also "g.blockdev_getsz".
2303    * <p>
2304    * This uses the blockdev(8) command.
2305    * <p>
2306    * @throws LibGuestFSException
2307    */
2308   public long blockdev_getsize64 (String device)
2309     throws LibGuestFSException
2310   {
2311     if (g == 0)
2312       throw new LibGuestFSException ("blockdev_getsize64: handle is closed");
2313     return _blockdev_getsize64 (g, device);
2314   }
2315   private native long _blockdev_getsize64 (long g, String device)
2316     throws LibGuestFSException;
2317
2318   /**
2319    * flush device buffers
2320    * <p>
2321    * This tells the kernel to flush internal buffers
2322    * associated with "device".
2323    * <p>
2324    * This uses the blockdev(8) command.
2325    * <p>
2326    * @throws LibGuestFSException
2327    */
2328   public void blockdev_flushbufs (String device)
2329     throws LibGuestFSException
2330   {
2331     if (g == 0)
2332       throw new LibGuestFSException ("blockdev_flushbufs: handle is closed");
2333     _blockdev_flushbufs (g, device);
2334   }
2335   private native void _blockdev_flushbufs (long g, String device)
2336     throws LibGuestFSException;
2337
2338   /**
2339    * reread partition table
2340    * <p>
2341    * Reread the partition table on "device".
2342    * <p>
2343    * This uses the blockdev(8) command.
2344    * <p>
2345    * @throws LibGuestFSException
2346    */
2347   public void blockdev_rereadpt (String device)
2348     throws LibGuestFSException
2349   {
2350     if (g == 0)
2351       throw new LibGuestFSException ("blockdev_rereadpt: handle is closed");
2352     _blockdev_rereadpt (g, device);
2353   }
2354   private native void _blockdev_rereadpt (long g, String device)
2355     throws LibGuestFSException;
2356
2357   /**
2358    * upload a file from the local machine
2359    * <p>
2360    * Upload local file "filename" to "remotefilename" on the
2361    * filesystem.
2362    * <p>
2363    * "filename" can also be a named pipe.
2364    * <p>
2365    * See also "g.download".
2366    * <p>
2367    * @throws LibGuestFSException
2368    */
2369   public void upload (String filename, String remotefilename)
2370     throws LibGuestFSException
2371   {
2372     if (g == 0)
2373       throw new LibGuestFSException ("upload: handle is closed");
2374     _upload (g, filename, remotefilename);
2375   }
2376   private native void _upload (long g, String filename, String remotefilename)
2377     throws LibGuestFSException;
2378
2379   /**
2380    * download a file to the local machine
2381    * <p>
2382    * Download file "remotefilename" and save it as "filename"
2383    * on the local machine.
2384    * <p>
2385    * "filename" can also be a named pipe.
2386    * <p>
2387    * See also "g.upload", "g.cat".
2388    * <p>
2389    * @throws LibGuestFSException
2390    */
2391   public void download (String remotefilename, String filename)
2392     throws LibGuestFSException
2393   {
2394     if (g == 0)
2395       throw new LibGuestFSException ("download: handle is closed");
2396     _download (g, remotefilename, filename);
2397   }
2398   private native void _download (long g, String remotefilename, String filename)
2399     throws LibGuestFSException;
2400
2401   /**
2402    * compute MD5, SHAx or CRC checksum of file
2403    * <p>
2404    * This call computes the MD5, SHAx or CRC checksum of the
2405    * file named "path".
2406    * <p>
2407    * The type of checksum to compute is given by the
2408    * "csumtype" parameter which must have one of the
2409    * following values:
2410    * <p>
2411    * "crc"
2412    * Compute the cyclic redundancy check (CRC) specified
2413    * by POSIX for the "cksum" command.
2414    * <p>
2415    * "md5"
2416    * Compute the MD5 hash (using the "md5sum" program).
2417    * <p>
2418    * "sha1"
2419    * Compute the SHA1 hash (using the "sha1sum" program).
2420    * <p>
2421    * "sha224"
2422    * Compute the SHA224 hash (using the "sha224sum"
2423    * program).
2424    * <p>
2425    * "sha256"
2426    * Compute the SHA256 hash (using the "sha256sum"
2427    * program).
2428    * <p>
2429    * "sha384"
2430    * Compute the SHA384 hash (using the "sha384sum"
2431    * program).
2432    * <p>
2433    * "sha512"
2434    * Compute the SHA512 hash (using the "sha512sum"
2435    * program).
2436    * <p>
2437    * The checksum is returned as a printable string.
2438    * <p>
2439    * @throws LibGuestFSException
2440    */
2441   public String checksum (String csumtype, String path)
2442     throws LibGuestFSException
2443   {
2444     if (g == 0)
2445       throw new LibGuestFSException ("checksum: handle is closed");
2446     return _checksum (g, csumtype, path);
2447   }
2448   private native String _checksum (long g, String csumtype, String path)
2449     throws LibGuestFSException;
2450
2451   /**
2452    * unpack tarfile to directory
2453    * <p>
2454    * This command uploads and unpacks local file "tarfile"
2455    * (an *uncompressed* tar file) into "directory".
2456    * <p>
2457    * To upload a compressed tarball, use "g.tgz_in".
2458    * <p>
2459    * @throws LibGuestFSException
2460    */
2461   public void tar_in (String tarfile, String directory)
2462     throws LibGuestFSException
2463   {
2464     if (g == 0)
2465       throw new LibGuestFSException ("tar_in: handle is closed");
2466     _tar_in (g, tarfile, directory);
2467   }
2468   private native void _tar_in (long g, String tarfile, String directory)
2469     throws LibGuestFSException;
2470
2471   /**
2472    * pack directory into tarfile
2473    * <p>
2474    * This command packs the contents of "directory" and
2475    * downloads it to local file "tarfile".
2476    * <p>
2477    * To download a compressed tarball, use "g.tgz_out".
2478    * <p>
2479    * @throws LibGuestFSException
2480    */
2481   public void tar_out (String directory, String tarfile)
2482     throws LibGuestFSException
2483   {
2484     if (g == 0)
2485       throw new LibGuestFSException ("tar_out: handle is closed");
2486     _tar_out (g, directory, tarfile);
2487   }
2488   private native void _tar_out (long g, String directory, String tarfile)
2489     throws LibGuestFSException;
2490
2491   /**
2492    * unpack compressed tarball to directory
2493    * <p>
2494    * This command uploads and unpacks local file "tarball" (a
2495    * *gzip compressed* tar file) into "directory".
2496    * <p>
2497    * To upload an uncompressed tarball, use "g.tar_in".
2498    * <p>
2499    * @throws LibGuestFSException
2500    */
2501   public void tgz_in (String tarball, String directory)
2502     throws LibGuestFSException
2503   {
2504     if (g == 0)
2505       throw new LibGuestFSException ("tgz_in: handle is closed");
2506     _tgz_in (g, tarball, directory);
2507   }
2508   private native void _tgz_in (long g, String tarball, String directory)
2509     throws LibGuestFSException;
2510
2511   /**
2512    * pack directory into compressed tarball
2513    * <p>
2514    * This command packs the contents of "directory" and
2515    * downloads it to local file "tarball".
2516    * <p>
2517    * To download an uncompressed tarball, use "g.tar_out".
2518    * <p>
2519    * @throws LibGuestFSException
2520    */
2521   public void tgz_out (String directory, String tarball)
2522     throws LibGuestFSException
2523   {
2524     if (g == 0)
2525       throw new LibGuestFSException ("tgz_out: handle is closed");
2526     _tgz_out (g, directory, tarball);
2527   }
2528   private native void _tgz_out (long g, String directory, String tarball)
2529     throws LibGuestFSException;
2530
2531   /**
2532    * mount a guest disk, read-only
2533    * <p>
2534    * This is the same as the "g.mount" command, but it mounts
2535    * the filesystem with the read-only (*-o ro*) flag.
2536    * <p>
2537    * @throws LibGuestFSException
2538    */
2539   public void mount_ro (String device, String mountpoint)
2540     throws LibGuestFSException
2541   {
2542     if (g == 0)
2543       throw new LibGuestFSException ("mount_ro: handle is closed");
2544     _mount_ro (g, device, mountpoint);
2545   }
2546   private native void _mount_ro (long g, String device, String mountpoint)
2547     throws LibGuestFSException;
2548
2549   /**
2550    * mount a guest disk with mount options
2551    * <p>
2552    * This is the same as the "g.mount" command, but it allows
2553    * you to set the mount options as for the mount(8) *-o*
2554    * flag.
2555    * <p>
2556    * @throws LibGuestFSException
2557    */
2558   public void mount_options (String options, String device, String mountpoint)
2559     throws LibGuestFSException
2560   {
2561     if (g == 0)
2562       throw new LibGuestFSException ("mount_options: handle is closed");
2563     _mount_options (g, options, device, mountpoint);
2564   }
2565   private native void _mount_options (long g, String options, String device, String mountpoint)
2566     throws LibGuestFSException;
2567
2568   /**
2569    * mount a guest disk with mount options and vfstype
2570    * <p>
2571    * This is the same as the "g.mount" command, but it allows
2572    * you to set both the mount options and the vfstype as for
2573    * the mount(8) *-o* and *-t* flags.
2574    * <p>
2575    * @throws LibGuestFSException
2576    */
2577   public void mount_vfs (String options, String vfstype, String device, String mountpoint)
2578     throws LibGuestFSException
2579   {
2580     if (g == 0)
2581       throw new LibGuestFSException ("mount_vfs: handle is closed");
2582     _mount_vfs (g, options, vfstype, device, mountpoint);
2583   }
2584   private native void _mount_vfs (long g, String options, String vfstype, String device, String mountpoint)
2585     throws LibGuestFSException;
2586
2587   /**
2588    * debugging and internals
2589    * <p>
2590    * The "g.debug" command exposes some internals of
2591    * "guestfsd" (the guestfs daemon) that runs inside the
2592    * qemu subprocess.
2593    * <p>
2594    * There is no comprehensive help for this command. You
2595    * have to look at the file "daemon/debug.c" in the
2596    * libguestfs source to find out what you can do.
2597    * <p>
2598    * @throws LibGuestFSException
2599    */
2600   public String debug (String subcmd, String[] extraargs)
2601     throws LibGuestFSException
2602   {
2603     if (g == 0)
2604       throw new LibGuestFSException ("debug: handle is closed");
2605     return _debug (g, subcmd, extraargs);
2606   }
2607   private native String _debug (long g, String subcmd, String[] extraargs)
2608     throws LibGuestFSException;
2609
2610   /**
2611    * remove an LVM logical volume
2612    * <p>
2613    * Remove an LVM logical volume "device", where "device" is
2614    * the path to the LV, such as "/dev/VG/LV".
2615    * <p>
2616    * You can also remove all LVs in a volume group by
2617    * specifying the VG name, "/dev/VG".
2618    * <p>
2619    * @throws LibGuestFSException
2620    */
2621   public void lvremove (String device)
2622     throws LibGuestFSException
2623   {
2624     if (g == 0)
2625       throw new LibGuestFSException ("lvremove: handle is closed");
2626     _lvremove (g, device);
2627   }
2628   private native void _lvremove (long g, String device)
2629     throws LibGuestFSException;
2630
2631   /**
2632    * remove an LVM volume group
2633    * <p>
2634    * Remove an LVM volume group "vgname", (for example "VG").
2635    * <p>
2636    * This also forcibly removes all logical volumes in the
2637    * volume group (if any).
2638    * <p>
2639    * @throws LibGuestFSException
2640    */
2641   public void vgremove (String vgname)
2642     throws LibGuestFSException
2643   {
2644     if (g == 0)
2645       throw new LibGuestFSException ("vgremove: handle is closed");
2646     _vgremove (g, vgname);
2647   }
2648   private native void _vgremove (long g, String vgname)
2649     throws LibGuestFSException;
2650
2651   /**
2652    * remove an LVM physical volume
2653    * <p>
2654    * This wipes a physical volume "device" so that LVM will
2655    * no longer recognise it.
2656    * <p>
2657    * The implementation uses the "pvremove" command which
2658    * refuses to wipe physical volumes that contain any volume
2659    * groups, so you have to remove those first.
2660    * <p>
2661    * @throws LibGuestFSException
2662    */
2663   public void pvremove (String device)
2664     throws LibGuestFSException
2665   {
2666     if (g == 0)
2667       throw new LibGuestFSException ("pvremove: handle is closed");
2668     _pvremove (g, device);
2669   }
2670   private native void _pvremove (long g, String device)
2671     throws LibGuestFSException;
2672
2673   /**
2674    * set the ext2/3/4 filesystem label
2675    * <p>
2676    * This sets the ext2/3/4 filesystem label of the
2677    * filesystem on "device" to "label". Filesystem labels are
2678    * limited to 16 characters.
2679    * <p>
2680    * You can use either "g.tune2fs_l" or "g.get_e2label" to
2681    * return the existing label on a filesystem.
2682    * <p>
2683    * @throws LibGuestFSException
2684    */
2685   public void set_e2label (String device, String label)
2686     throws LibGuestFSException
2687   {
2688     if (g == 0)
2689       throw new LibGuestFSException ("set_e2label: handle is closed");
2690     _set_e2label (g, device, label);
2691   }
2692   private native void _set_e2label (long g, String device, String label)
2693     throws LibGuestFSException;
2694
2695   /**
2696    * get the ext2/3/4 filesystem label
2697    * <p>
2698    * This returns the ext2/3/4 filesystem label of the
2699    * filesystem on "device".
2700    * <p>
2701    * @throws LibGuestFSException
2702    */
2703   public String get_e2label (String device)
2704     throws LibGuestFSException
2705   {
2706     if (g == 0)
2707       throw new LibGuestFSException ("get_e2label: handle is closed");
2708     return _get_e2label (g, device);
2709   }
2710   private native String _get_e2label (long g, String device)
2711     throws LibGuestFSException;
2712
2713   /**
2714    * set the ext2/3/4 filesystem UUID
2715    * <p>
2716    * This sets the ext2/3/4 filesystem UUID of the filesystem
2717    * on "device" to "uuid". The format of the UUID and
2718    * alternatives such as "clear", "random" and "time" are
2719    * described in the tune2fs(8) manpage.
2720    * <p>
2721    * You can use either "g.tune2fs_l" or "g.get_e2uuid" to
2722    * return the existing UUID of a filesystem.
2723    * <p>
2724    * @throws LibGuestFSException
2725    */
2726   public void set_e2uuid (String device, String uuid)
2727     throws LibGuestFSException
2728   {
2729     if (g == 0)
2730       throw new LibGuestFSException ("set_e2uuid: handle is closed");
2731     _set_e2uuid (g, device, uuid);
2732   }
2733   private native void _set_e2uuid (long g, String device, String uuid)
2734     throws LibGuestFSException;
2735
2736   /**
2737    * get the ext2/3/4 filesystem UUID
2738    * <p>
2739    * This returns the ext2/3/4 filesystem UUID of the
2740    * filesystem on "device".
2741    * <p>
2742    * @throws LibGuestFSException
2743    */
2744   public String get_e2uuid (String device)
2745     throws LibGuestFSException
2746   {
2747     if (g == 0)
2748       throw new LibGuestFSException ("get_e2uuid: handle is closed");
2749     return _get_e2uuid (g, device);
2750   }
2751   private native String _get_e2uuid (long g, String device)
2752     throws LibGuestFSException;
2753
2754   /**
2755    * run the filesystem checker
2756    * <p>
2757    * This runs the filesystem checker (fsck) on "device"
2758    * which should have filesystem type "fstype".
2759    * <p>
2760    * The returned integer is the status. See fsck(8) for the
2761    * list of status codes from "fsck".
2762    * <p>
2763    * Notes:
2764    * <p>
2765    * *   Multiple status codes can be summed together.
2766    * <p>
2767    * *   A non-zero return code can mean "success", for
2768    * example if errors have been corrected on the
2769    * filesystem.
2770    * <p>
2771    * *   Checking or repairing NTFS volumes is not supported
2772    * (by linux-ntfs).
2773    * <p>
2774    * This command is entirely equivalent to running "fsck -a
2775    * -t fstype device".
2776    * <p>
2777    * @throws LibGuestFSException
2778    */
2779   public int fsck (String fstype, String device)
2780     throws LibGuestFSException
2781   {
2782     if (g == 0)
2783       throw new LibGuestFSException ("fsck: handle is closed");
2784     return _fsck (g, fstype, device);
2785   }
2786   private native int _fsck (long g, String fstype, String device)
2787     throws LibGuestFSException;
2788
2789   /**
2790    * write zeroes to the device
2791    * <p>
2792    * This command writes zeroes over the first few blocks of
2793    * "device".
2794    * <p>
2795    * How many blocks are zeroed isn't specified (but it's
2796    * *not* enough to securely wipe the device). It should be
2797    * sufficient to remove any partition tables, filesystem
2798    * superblocks and so on.
2799    * <p>
2800    * @throws LibGuestFSException
2801    */
2802   public void zero (String device)
2803     throws LibGuestFSException
2804   {
2805     if (g == 0)
2806       throw new LibGuestFSException ("zero: handle is closed");
2807     _zero (g, device);
2808   }
2809   private native void _zero (long g, String device)
2810     throws LibGuestFSException;
2811
2812   /**
2813    * install GRUB
2814    * <p>
2815    * This command installs GRUB (the Grand Unified
2816    * Bootloader) on "device", with the root directory being
2817    * "root".
2818    * <p>
2819    * @throws LibGuestFSException
2820    */
2821   public void grub_install (String root, String device)
2822     throws LibGuestFSException
2823   {
2824     if (g == 0)
2825       throw new LibGuestFSException ("grub_install: handle is closed");
2826     _grub_install (g, root, device);
2827   }
2828   private native void _grub_install (long g, String root, String device)
2829     throws LibGuestFSException;
2830
2831   /**
2832    * copy a file
2833    * <p>
2834    * This copies a file from "src" to "dest" where "dest" is
2835    * either a destination filename or destination directory.
2836    * <p>
2837    * @throws LibGuestFSException
2838    */
2839   public void cp (String src, String dest)
2840     throws LibGuestFSException
2841   {
2842     if (g == 0)
2843       throw new LibGuestFSException ("cp: handle is closed");
2844     _cp (g, src, dest);
2845   }
2846   private native void _cp (long g, String src, String dest)
2847     throws LibGuestFSException;
2848
2849   /**
2850    * copy a file or directory recursively
2851    * <p>
2852    * This copies a file or directory from "src" to "dest"
2853    * recursively using the "cp -a" command.
2854    * <p>
2855    * @throws LibGuestFSException
2856    */
2857   public void cp_a (String src, String dest)
2858     throws LibGuestFSException
2859   {
2860     if (g == 0)
2861       throw new LibGuestFSException ("cp_a: handle is closed");
2862     _cp_a (g, src, dest);
2863   }
2864   private native void _cp_a (long g, String src, String dest)
2865     throws LibGuestFSException;
2866
2867   /**
2868    * move a file
2869    * <p>
2870    * This moves a file from "src" to "dest" where "dest" is
2871    * either a destination filename or destination directory.
2872    * <p>
2873    * @throws LibGuestFSException
2874    */
2875   public void mv (String src, String dest)
2876     throws LibGuestFSException
2877   {
2878     if (g == 0)
2879       throw new LibGuestFSException ("mv: handle is closed");
2880     _mv (g, src, dest);
2881   }
2882   private native void _mv (long g, String src, String dest)
2883     throws LibGuestFSException;
2884
2885   /**
2886    * drop kernel page cache, dentries and inodes
2887    * <p>
2888    * This instructs the guest kernel to drop its page cache,
2889    * and/or dentries and inode caches. The parameter
2890    * "whattodrop" tells the kernel what precisely to drop,
2891    * see <http://linux-mm.org/Drop_Caches>
2892    * <p>
2893    * Setting "whattodrop" to 3 should drop everything.
2894    * <p>
2895    * This automatically calls sync(2) before the operation,
2896    * so that the maximum guest memory is freed.
2897    * <p>
2898    * @throws LibGuestFSException
2899    */
2900   public void drop_caches (int whattodrop)
2901     throws LibGuestFSException
2902   {
2903     if (g == 0)
2904       throw new LibGuestFSException ("drop_caches: handle is closed");
2905     _drop_caches (g, whattodrop);
2906   }
2907   private native void _drop_caches (long g, int whattodrop)
2908     throws LibGuestFSException;
2909
2910   /**
2911    * return kernel messages
2912    * <p>
2913    * This returns the kernel messages ("dmesg" output) from
2914    * the guest kernel. This is sometimes useful for extended
2915    * debugging of problems.
2916    * <p>
2917    * Another way to get the same information is to enable
2918    * verbose messages with "g.set_verbose" or by setting the
2919    * environment variable "LIBGUESTFS_DEBUG=1" before running
2920    * the program.
2921    * <p>
2922    * @throws LibGuestFSException
2923    */
2924   public String dmesg ()
2925     throws LibGuestFSException
2926   {
2927     if (g == 0)
2928       throw new LibGuestFSException ("dmesg: handle is closed");
2929     return _dmesg (g);
2930   }
2931   private native String _dmesg (long g)
2932     throws LibGuestFSException;
2933
2934   /**
2935    * ping the guest daemon
2936    * <p>
2937    * This is a test probe into the guestfs daemon running
2938    * inside the qemu subprocess. Calling this function checks
2939    * that the daemon responds to the ping message, without
2940    * affecting the daemon or attached block device(s) in any
2941    * other way.
2942    * <p>
2943    * @throws LibGuestFSException
2944    */
2945   public void ping_daemon ()
2946     throws LibGuestFSException
2947   {
2948     if (g == 0)
2949       throw new LibGuestFSException ("ping_daemon: handle is closed");
2950     _ping_daemon (g);
2951   }
2952   private native void _ping_daemon (long g)
2953     throws LibGuestFSException;
2954
2955   /**
2956    * test if two files have equal contents
2957    * <p>
2958    * This compares the two files "file1" and "file2" and
2959    * returns true if their content is exactly equal, or false
2960    * otherwise.
2961    * <p>
2962    * The external cmp(1) program is used for the comparison.
2963    * <p>
2964    * @throws LibGuestFSException
2965    */
2966   public boolean equal (String file1, String file2)
2967     throws LibGuestFSException
2968   {
2969     if (g == 0)
2970       throw new LibGuestFSException ("equal: handle is closed");
2971     return _equal (g, file1, file2);
2972   }
2973   private native boolean _equal (long g, String file1, String file2)
2974     throws LibGuestFSException;
2975
2976   /**
2977    * print the printable strings in a file
2978    * <p>
2979    * This runs the strings(1) command on a file and returns
2980    * the list of printable strings found.
2981    * <p>
2982    * Because of the message protocol, there is a transfer
2983    * limit of somewhere between 2MB and 4MB. To transfer
2984    * large files you should use FTP.
2985    * <p>
2986    * @throws LibGuestFSException
2987    */
2988   public String[] strings (String path)
2989     throws LibGuestFSException
2990   {
2991     if (g == 0)
2992       throw new LibGuestFSException ("strings: handle is closed");
2993     return _strings (g, path);
2994   }
2995   private native String[] _strings (long g, String path)
2996     throws LibGuestFSException;
2997
2998   /**
2999    * print the printable strings in a file
3000    * <p>
3001    * This is like the "g.strings" command, but allows you to
3002    * specify the encoding.
3003    * <p>
3004    * See the strings(1) manpage for the full list of
3005    * encodings.
3006    * <p>
3007    * Commonly useful encodings are "l" (lower case L) which
3008    * will show strings inside Windows/x86 files.
3009    * <p>
3010    * The returned strings are transcoded to UTF-8.
3011    * <p>
3012    * Because of the message protocol, there is a transfer
3013    * limit of somewhere between 2MB and 4MB. To transfer
3014    * large files you should use FTP.
3015    * <p>
3016    * @throws LibGuestFSException
3017    */
3018   public String[] strings_e (String encoding, String path)
3019     throws LibGuestFSException
3020   {
3021     if (g == 0)
3022       throw new LibGuestFSException ("strings_e: handle is closed");
3023     return _strings_e (g, encoding, path);
3024   }
3025   private native String[] _strings_e (long g, String encoding, String path)
3026     throws LibGuestFSException;
3027
3028   /**
3029    * dump a file in hexadecimal
3030    * <p>
3031    * This runs "hexdump -C" on the given "path". The result
3032    * is the human-readable, canonical hex dump of the file.
3033    * <p>
3034    * Because of the message protocol, there is a transfer
3035    * limit of somewhere between 2MB and 4MB. To transfer
3036    * large files you should use FTP.
3037    * <p>
3038    * @throws LibGuestFSException
3039    */
3040   public String hexdump (String path)
3041     throws LibGuestFSException
3042   {
3043     if (g == 0)
3044       throw new LibGuestFSException ("hexdump: handle is closed");
3045     return _hexdump (g, path);
3046   }
3047   private native String _hexdump (long g, String path)
3048     throws LibGuestFSException;
3049
3050   /**
3051    * zero unused inodes and disk blocks on ext2/3 filesystem
3052    * <p>
3053    * This runs the *zerofree* program on "device". This
3054    * program claims to zero unused inodes and disk blocks on
3055    * an ext2/3 filesystem, thus making it possible to
3056    * compress the filesystem more effectively.
3057    * <p>
3058    * You should not run this program if the filesystem is
3059    * mounted.
3060    * <p>
3061    * It is possible that using this program can damage the
3062    * filesystem or data on the filesystem.
3063    * <p>
3064    * @throws LibGuestFSException
3065    */
3066   public void zerofree (String device)
3067     throws LibGuestFSException
3068   {
3069     if (g == 0)
3070       throw new LibGuestFSException ("zerofree: handle is closed");
3071     _zerofree (g, device);
3072   }
3073   private native void _zerofree (long g, String device)
3074     throws LibGuestFSException;
3075
3076   /**
3077    * resize an LVM physical volume
3078    * <p>
3079    * This resizes (expands or shrinks) an existing LVM
3080    * physical volume to match the new size of the underlying
3081    * device.
3082    * <p>
3083    * @throws LibGuestFSException
3084    */
3085   public void pvresize (String device)
3086     throws LibGuestFSException
3087   {
3088     if (g == 0)
3089       throw new LibGuestFSException ("pvresize: handle is closed");
3090     _pvresize (g, device);
3091   }
3092   private native void _pvresize (long g, String device)
3093     throws LibGuestFSException;
3094
3095   /**
3096    * modify a single partition on a block device
3097    * <p>
3098    * This runs sfdisk(8) option to modify just the single
3099    * partition "n" (note: "n" counts from 1).
3100    * <p>
3101    * For other parameters, see "g.sfdisk". You should usually
3102    * pass 0 for the cyls/heads/sectors parameters.
3103    * <p>
3104    * This command is dangerous. Without careful use you can
3105    * easily destroy all your data.
3106    * <p>
3107    * @throws LibGuestFSException
3108    */
3109   public void sfdisk_N (String device, int n, int cyls, int heads, int sectors, String line)
3110     throws LibGuestFSException
3111   {
3112     if (g == 0)
3113       throw new LibGuestFSException ("sfdisk_N: handle is closed");
3114     _sfdisk_N (g, device, n, cyls, heads, sectors, line);
3115   }
3116   private native void _sfdisk_N (long g, String device, int n, int cyls, int heads, int sectors, String line)
3117     throws LibGuestFSException;
3118
3119   /**
3120    * display the partition table
3121    * <p>
3122    * This displays the partition table on "device", in the
3123    * human-readable output of the sfdisk(8) command. It is
3124    * not intended to be parsed.
3125    * <p>
3126    * @throws LibGuestFSException
3127    */
3128   public String sfdisk_l (String device)
3129     throws LibGuestFSException
3130   {
3131     if (g == 0)
3132       throw new LibGuestFSException ("sfdisk_l: handle is closed");
3133     return _sfdisk_l (g, device);
3134   }
3135   private native String _sfdisk_l (long g, String device)
3136     throws LibGuestFSException;
3137
3138   /**
3139    * display the kernel geometry
3140    * <p>
3141    * This displays the kernel's idea of the geometry of
3142    * "device".
3143    * <p>
3144    * The result is in human-readable format, and not designed
3145    * to be parsed.
3146    * <p>
3147    * @throws LibGuestFSException
3148    */
3149   public String sfdisk_kernel_geometry (String device)
3150     throws LibGuestFSException
3151   {
3152     if (g == 0)
3153       throw new LibGuestFSException ("sfdisk_kernel_geometry: handle is closed");
3154     return _sfdisk_kernel_geometry (g, device);
3155   }
3156   private native String _sfdisk_kernel_geometry (long g, String device)
3157     throws LibGuestFSException;
3158
3159   /**
3160    * display the disk geometry from the partition table
3161    * <p>
3162    * This displays the disk geometry of "device" read from
3163    * the partition table. Especially in the case where the
3164    * underlying block device has been resized, this can be
3165    * different from the kernel's idea of the geometry (see
3166    * "g.sfdisk_kernel_geometry").
3167    * <p>
3168    * The result is in human-readable format, and not designed
3169    * to be parsed.
3170    * <p>
3171    * @throws LibGuestFSException
3172    */
3173   public String sfdisk_disk_geometry (String device)
3174     throws LibGuestFSException
3175   {
3176     if (g == 0)
3177       throw new LibGuestFSException ("sfdisk_disk_geometry: handle is closed");
3178     return _sfdisk_disk_geometry (g, device);
3179   }
3180   private native String _sfdisk_disk_geometry (long g, String device)
3181     throws LibGuestFSException;
3182
3183   /**
3184    * activate or deactivate all volume groups
3185    * <p>
3186    * This command activates or (if "activate" is false)
3187    * deactivates all logical volumes in all volume groups. If
3188    * activated, then they are made known to the kernel, ie.
3189    * they appear as "/dev/mapper" devices. If deactivated,
3190    * then those devices disappear.
3191    * <p>
3192    * This command is the same as running "vgchange -a y|n"
3193    * <p>
3194    * @throws LibGuestFSException
3195    */
3196   public void vg_activate_all (boolean activate)
3197     throws LibGuestFSException
3198   {
3199     if (g == 0)
3200       throw new LibGuestFSException ("vg_activate_all: handle is closed");
3201     _vg_activate_all (g, activate);
3202   }
3203   private native void _vg_activate_all (long g, boolean activate)
3204     throws LibGuestFSException;
3205
3206   /**
3207    * activate or deactivate some volume groups
3208    * <p>
3209    * This command activates or (if "activate" is false)
3210    * deactivates all logical volumes in the listed volume
3211    * groups "volgroups". If activated, then they are made
3212    * known to the kernel, ie. they appear as "/dev/mapper"
3213    * devices. If deactivated, then those devices disappear.
3214    * <p>
3215    * This command is the same as running "vgchange -a y|n
3216    * volgroups..."
3217    * <p>
3218    * Note that if "volgroups" is an empty list then all
3219    * volume groups are activated or deactivated.
3220    * <p>
3221    * @throws LibGuestFSException
3222    */
3223   public void vg_activate (boolean activate, String[] volgroups)
3224     throws LibGuestFSException
3225   {
3226     if (g == 0)
3227       throw new LibGuestFSException ("vg_activate: handle is closed");
3228     _vg_activate (g, activate, volgroups);
3229   }
3230   private native void _vg_activate (long g, boolean activate, String[] volgroups)
3231     throws LibGuestFSException;
3232
3233   /**
3234    * resize an LVM logical volume
3235    * <p>
3236    * This resizes (expands or shrinks) an existing LVM
3237    * logical volume to "mbytes". When reducing, data in the
3238    * reduced part is lost.
3239    * <p>
3240    * @throws LibGuestFSException
3241    */
3242   public void lvresize (String device, int mbytes)
3243     throws LibGuestFSException
3244   {
3245     if (g == 0)
3246       throw new LibGuestFSException ("lvresize: handle is closed");
3247     _lvresize (g, device, mbytes);
3248   }
3249   private native void _lvresize (long g, String device, int mbytes)
3250     throws LibGuestFSException;
3251
3252   /**
3253    * resize an ext2/ext3 filesystem
3254    * <p>
3255    * This resizes an ext2 or ext3 filesystem to match the
3256    * size of the underlying device.
3257    * <p>
3258    * *Note:* It is sometimes required that you run
3259    * "g.e2fsck_f" on the "device" before calling this
3260    * command. For unknown reasons "resize2fs" sometimes gives
3261    * an error about this and sometimes not. In any case, it
3262    * is always safe to call "g.e2fsck_f" before calling this
3263    * function.
3264    * <p>
3265    * @throws LibGuestFSException
3266    */
3267   public void resize2fs (String device)
3268     throws LibGuestFSException
3269   {
3270     if (g == 0)
3271       throw new LibGuestFSException ("resize2fs: handle is closed");
3272     _resize2fs (g, device);
3273   }
3274   private native void _resize2fs (long g, String device)
3275     throws LibGuestFSException;
3276
3277   /**
3278    * find all files and directories
3279    * <p>
3280    * This command lists out all files and directories,
3281    * recursively, starting at "directory". It is essentially
3282    * equivalent to running the shell command "find directory
3283    * -print" but some post-processing happens on the output,
3284    * described below.
3285    * <p>
3286    * This returns a list of strings *without any prefix*.
3287    * Thus if the directory structure was:
3288    * <p>
3289    * /tmp/a
3290    * /tmp/b
3291    * /tmp/c/d
3292    * <p>
3293    * then the returned list from "g.find" "/tmp" would be 4
3294    * elements:
3295    * <p>
3296    * a
3297    * b
3298    * c
3299    * c/d
3300    * <p>
3301    * If "directory" is not a directory, then this command
3302    * returns an error.
3303    * <p>
3304    * The returned list is sorted.
3305    * <p>
3306    * @throws LibGuestFSException
3307    */
3308   public String[] find (String directory)
3309     throws LibGuestFSException
3310   {
3311     if (g == 0)
3312       throw new LibGuestFSException ("find: handle is closed");
3313     return _find (g, directory);
3314   }
3315   private native String[] _find (long g, String directory)
3316     throws LibGuestFSException;
3317
3318   /**
3319    * check an ext2/ext3 filesystem
3320    * <p>
3321    * This runs "e2fsck -p -f device", ie. runs the ext2/ext3
3322    * filesystem checker on "device", noninteractively ("-p"),
3323    * even if the filesystem appears to be clean ("-f").
3324    * <p>
3325    * This command is only needed because of "g.resize2fs"
3326    * (q.v.). Normally you should use "g.fsck".
3327    * <p>
3328    * @throws LibGuestFSException
3329    */
3330   public void e2fsck_f (String device)
3331     throws LibGuestFSException
3332   {
3333     if (g == 0)
3334       throw new LibGuestFSException ("e2fsck_f: handle is closed");
3335     _e2fsck_f (g, device);
3336   }
3337   private native void _e2fsck_f (long g, String device)
3338     throws LibGuestFSException;
3339
3340   /**
3341    * sleep for some seconds
3342    * <p>
3343    * Sleep for "secs" seconds.
3344    * <p>
3345    * @throws LibGuestFSException
3346    */
3347   public void sleep (int secs)
3348     throws LibGuestFSException
3349   {
3350     if (g == 0)
3351       throw new LibGuestFSException ("sleep: handle is closed");
3352     _sleep (g, secs);
3353   }
3354   private native void _sleep (long g, int secs)
3355     throws LibGuestFSException;
3356
3357   /**
3358    * probe NTFS volume
3359    * <p>
3360    * This command runs the ntfs-3g.probe(8) command which
3361    * probes an NTFS "device" for mountability. (Not all NTFS
3362    * volumes can be mounted read-write, and some cannot be
3363    * mounted at all).
3364    * <p>
3365    * "rw" is a boolean flag. Set it to true if you want to
3366    * test if the volume can be mounted read-write. Set it to
3367    * false if you want to test if the volume can be mounted
3368    * read-only.
3369    * <p>
3370    * The return value is an integer which 0 if the operation
3371    * would succeed, or some non-zero value documented in the
3372    * ntfs-3g.probe(8) manual page.
3373    * <p>
3374    * @throws LibGuestFSException
3375    */
3376   public int ntfs_3g_probe (boolean rw, String device)
3377     throws LibGuestFSException
3378   {
3379     if (g == 0)
3380       throw new LibGuestFSException ("ntfs_3g_probe: handle is closed");
3381     return _ntfs_3g_probe (g, rw, device);
3382   }
3383   private native int _ntfs_3g_probe (long g, boolean rw, String device)
3384     throws LibGuestFSException;
3385
3386 }