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