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