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