Java bindings compile, not tested.
[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   /**
85    * launch the qemu subprocess
86    *
87    * Internally libguestfs is implemented by running a
88    * virtual machine using qemu(1).
89    * 
90    * You should call this after configuring the handle (eg.
91    * adding drives) but before performing any actions.
92    * 
93    * @throws LibGuestFSException
94    */
95   public void launch ()
96     throws LibGuestFSException
97   {
98     if (g == 0)
99       throw new LibGuestFSException ("launch: handle is closed");
100     _launch (g);
101   }
102   private native void _launch (long g)
103     throws LibGuestFSException;
104
105   /**
106    * wait until the qemu subprocess launches
107    *
108    * Internally libguestfs is implemented by running a
109    * virtual machine using qemu(1).
110    * 
111    * You should call this after "g.launch" to wait for the
112    * launch to complete.
113    * 
114    * @throws LibGuestFSException
115    */
116   public void wait_ready ()
117     throws LibGuestFSException
118   {
119     if (g == 0)
120       throw new LibGuestFSException ("wait_ready: handle is closed");
121     _wait_ready (g);
122   }
123   private native void _wait_ready (long g)
124     throws LibGuestFSException;
125
126   /**
127    * kill the qemu subprocess
128    *
129    * This kills the qemu subprocess. You should never need to
130    * call this.
131    * 
132    * @throws LibGuestFSException
133    */
134   public void kill_subprocess ()
135     throws LibGuestFSException
136   {
137     if (g == 0)
138       throw new LibGuestFSException ("kill_subprocess: handle is closed");
139     _kill_subprocess (g);
140   }
141   private native void _kill_subprocess (long g)
142     throws LibGuestFSException;
143
144   /**
145    * add an image to examine or modify
146    *
147    * This function adds a virtual machine disk image
148    * "filename" to the guest. The first time you call this
149    * function, the disk appears as IDE disk 0 ("/dev/sda") in
150    * the guest, the second time as "/dev/sdb", and so on.
151    * 
152    * You don't necessarily need to be root when using
153    * libguestfs. However you obviously do need sufficient
154    * permissions to access the filename for whatever
155    * operations you want to perform (ie. read access if you
156    * just want to read the image or write access if you want
157    * to modify the image).
158    * 
159    * This is equivalent to the qemu parameter "-drive
160    * file=filename".
161    * 
162    * @throws LibGuestFSException
163    */
164   public void add_drive (String filename)
165     throws LibGuestFSException
166   {
167     if (g == 0)
168       throw new LibGuestFSException ("add_drive: handle is closed");
169     _add_drive (g, filename);
170   }
171   private native void _add_drive (long g, String filename)
172     throws LibGuestFSException;
173
174   /**
175    * add a CD-ROM disk image to examine
176    *
177    * This function adds a virtual CD-ROM disk image to the
178    * guest.
179    * 
180    * This is equivalent to the qemu parameter "-cdrom
181    * filename".
182    * 
183    * @throws LibGuestFSException
184    */
185   public void add_cdrom (String filename)
186     throws LibGuestFSException
187   {
188     if (g == 0)
189       throw new LibGuestFSException ("add_cdrom: handle is closed");
190     _add_cdrom (g, filename);
191   }
192   private native void _add_cdrom (long g, String filename)
193     throws LibGuestFSException;
194
195   /**
196    * add qemu parameters
197    *
198    * This can be used to add arbitrary qemu command line
199    * parameters of the form "-param value". Actually it's not
200    * quite arbitrary - we prevent you from setting some
201    * parameters which would interfere with parameters that we
202    * use.
203    * 
204    * The first character of "param" string must be a "-"
205    * (dash).
206    * 
207    * "value" can be NULL.
208    * 
209    * @throws LibGuestFSException
210    */
211   public void config (String qemuparam, String qemuvalue)
212     throws LibGuestFSException
213   {
214     if (g == 0)
215       throw new LibGuestFSException ("config: handle is closed");
216     _config (g, qemuparam, qemuvalue);
217   }
218   private native void _config (long g, String qemuparam, String qemuvalue)
219     throws LibGuestFSException;
220
221   /**
222    * set the search path
223    *
224    * Set the path that libguestfs searches for kernel and
225    * initrd.img.
226    * 
227    * The default is "$libdir/guestfs" unless overridden by
228    * setting "LIBGUESTFS_PATH" environment variable.
229    * 
230    * The string "path" is stashed in the libguestfs handle,
231    * so the caller must make sure it remains valid for the
232    * lifetime of the handle.
233    * 
234    * Setting "path" to "NULL" restores the default path.
235    * 
236    * @throws LibGuestFSException
237    */
238   public void set_path (String path)
239     throws LibGuestFSException
240   {
241     if (g == 0)
242       throw new LibGuestFSException ("set_path: handle is closed");
243     _set_path (g, path);
244   }
245   private native void _set_path (long g, String path)
246     throws LibGuestFSException;
247
248   /**
249    * get the search path
250    *
251    * Return the current search path.
252    * 
253    * This is always non-NULL. If it wasn't set already, then
254    * this will return the default path.
255    * 
256    * @throws LibGuestFSException
257    */
258   public String get_path ()
259     throws LibGuestFSException
260   {
261     if (g == 0)
262       throw new LibGuestFSException ("get_path: handle is closed");
263     return _get_path (g);
264   }
265   private native String _get_path (long g)
266     throws LibGuestFSException;
267
268   /**
269    * set autosync mode
270    *
271    * If "autosync" is true, this enables autosync. Libguestfs
272    * will make a best effort attempt to run "g.sync" when the
273    * handle is closed (also if the program exits without
274    * closing handles).
275    * 
276    * @throws LibGuestFSException
277    */
278   public void set_autosync (boolean autosync)
279     throws LibGuestFSException
280   {
281     if (g == 0)
282       throw new LibGuestFSException ("set_autosync: handle is closed");
283     _set_autosync (g, autosync);
284   }
285   private native void _set_autosync (long g, boolean autosync)
286     throws LibGuestFSException;
287
288   /**
289    * get autosync mode
290    *
291    * Get the autosync flag.
292    * 
293    * @throws LibGuestFSException
294    */
295   public boolean get_autosync ()
296     throws LibGuestFSException
297   {
298     if (g == 0)
299       throw new LibGuestFSException ("get_autosync: handle is closed");
300     return _get_autosync (g);
301   }
302   private native boolean _get_autosync (long g)
303     throws LibGuestFSException;
304
305   /**
306    * set verbose mode
307    *
308    * If "verbose" is true, this turns on verbose messages (to
309    * "stderr").
310    * 
311    * Verbose messages are disabled unless the environment
312    * variable "LIBGUESTFS_DEBUG" is defined and set to 1.
313    * 
314    * @throws LibGuestFSException
315    */
316   public void set_verbose (boolean verbose)
317     throws LibGuestFSException
318   {
319     if (g == 0)
320       throw new LibGuestFSException ("set_verbose: handle is closed");
321     _set_verbose (g, verbose);
322   }
323   private native void _set_verbose (long g, boolean verbose)
324     throws LibGuestFSException;
325
326   /**
327    * get verbose mode
328    *
329    * This returns the verbose messages flag.
330    * 
331    * @throws LibGuestFSException
332    */
333   public boolean get_verbose ()
334     throws LibGuestFSException
335   {
336     if (g == 0)
337       throw new LibGuestFSException ("get_verbose: handle is closed");
338     return _get_verbose (g);
339   }
340   private native boolean _get_verbose (long g)
341     throws LibGuestFSException;
342
343   /**
344    * is ready to accept commands
345    *
346    * This returns true iff this handle is ready to accept
347    * commands (in the "READY" state).
348    * 
349    * For more information on states, see guestfs(3).
350    * 
351    * @throws LibGuestFSException
352    */
353   public boolean is_ready ()
354     throws LibGuestFSException
355   {
356     if (g == 0)
357       throw new LibGuestFSException ("is_ready: handle is closed");
358     return _is_ready (g);
359   }
360   private native boolean _is_ready (long g)
361     throws LibGuestFSException;
362
363   /**
364    * is in configuration state
365    *
366    * This returns true iff this handle is being configured
367    * (in the "CONFIG" state).
368    * 
369    * For more information on states, see guestfs(3).
370    * 
371    * @throws LibGuestFSException
372    */
373   public boolean is_config ()
374     throws LibGuestFSException
375   {
376     if (g == 0)
377       throw new LibGuestFSException ("is_config: handle is closed");
378     return _is_config (g);
379   }
380   private native boolean _is_config (long g)
381     throws LibGuestFSException;
382
383   /**
384    * is launching subprocess
385    *
386    * This returns true iff this handle is launching the
387    * subprocess (in the "LAUNCHING" state).
388    * 
389    * For more information on states, see guestfs(3).
390    * 
391    * @throws LibGuestFSException
392    */
393   public boolean is_launching ()
394     throws LibGuestFSException
395   {
396     if (g == 0)
397       throw new LibGuestFSException ("is_launching: handle is closed");
398     return _is_launching (g);
399   }
400   private native boolean _is_launching (long g)
401     throws LibGuestFSException;
402
403   /**
404    * is busy processing a command
405    *
406    * This returns true iff this handle is busy processing a
407    * command (in the "BUSY" state).
408    * 
409    * For more information on states, see guestfs(3).
410    * 
411    * @throws LibGuestFSException
412    */
413   public boolean is_busy ()
414     throws LibGuestFSException
415   {
416     if (g == 0)
417       throw new LibGuestFSException ("is_busy: handle is closed");
418     return _is_busy (g);
419   }
420   private native boolean _is_busy (long g)
421     throws LibGuestFSException;
422
423   /**
424    * get the current state
425    *
426    * This returns the current state as an opaque integer.
427    * This is only useful for printing debug and internal
428    * error messages.
429    * 
430    * For more information on states, see guestfs(3).
431    * 
432    * @throws LibGuestFSException
433    */
434   public int get_state ()
435     throws LibGuestFSException
436   {
437     if (g == 0)
438       throw new LibGuestFSException ("get_state: handle is closed");
439     return _get_state (g);
440   }
441   private native int _get_state (long g)
442     throws LibGuestFSException;
443
444   /**
445    * set state to busy
446    *
447    * This sets the state to "BUSY". This is only used when
448    * implementing actions using the low-level API.
449    * 
450    * For more information on states, see guestfs(3).
451    * 
452    * @throws LibGuestFSException
453    */
454   public void set_busy ()
455     throws LibGuestFSException
456   {
457     if (g == 0)
458       throw new LibGuestFSException ("set_busy: handle is closed");
459     _set_busy (g);
460   }
461   private native void _set_busy (long g)
462     throws LibGuestFSException;
463
464   /**
465    * set state to ready
466    *
467    * This sets the state to "READY". This is only used when
468    * implementing actions using the low-level API.
469    * 
470    * For more information on states, see guestfs(3).
471    * 
472    * @throws LibGuestFSException
473    */
474   public void set_ready ()
475     throws LibGuestFSException
476   {
477     if (g == 0)
478       throw new LibGuestFSException ("set_ready: handle is closed");
479     _set_ready (g);
480   }
481   private native void _set_ready (long g)
482     throws LibGuestFSException;
483
484   /**
485    * mount a guest disk at a position in the filesystem
486    *
487    * Mount a guest disk at a position in the filesystem.
488    * Block devices are named "/dev/sda", "/dev/sdb" and so
489    * on, as they were added to the guest. If those block
490    * devices contain partitions, they will have the usual
491    * names (eg. "/dev/sda1"). Also LVM "/dev/VG/LV"-style
492    * names can be used.
493    * 
494    * The rules are the same as for mount(2): A filesystem
495    * must first be mounted on "/" before others can be
496    * mounted. Other filesystems can only be mounted on
497    * directories which already exist.
498    * 
499    * The mounted filesystem is writable, if we have
500    * sufficient permissions on the underlying device.
501    * 
502    * The filesystem options "sync" and "noatime" are set with
503    * this call, in order to improve reliability.
504    * 
505    * @throws LibGuestFSException
506    */
507   public void mount (String device, String mountpoint)
508     throws LibGuestFSException
509   {
510     if (g == 0)
511       throw new LibGuestFSException ("mount: handle is closed");
512     _mount (g, device, mountpoint);
513   }
514   private native void _mount (long g, String device, String mountpoint)
515     throws LibGuestFSException;
516
517   /**
518    * sync disks, writes are flushed through to the disk image
519    *
520    * This syncs the disk, so that any writes are flushed
521    * through to the underlying disk image.
522    * 
523    * You should always call this if you have modified a disk
524    * image, before closing the handle.
525    * 
526    * @throws LibGuestFSException
527    */
528   public void sync ()
529     throws LibGuestFSException
530   {
531     if (g == 0)
532       throw new LibGuestFSException ("sync: handle is closed");
533     _sync (g);
534   }
535   private native void _sync (long g)
536     throws LibGuestFSException;
537
538   /**
539    * update file timestamps or create a new file
540    *
541    * Touch acts like the touch(1) command. It can be used to
542    * update the timestamps on a file, or, if the file does
543    * not exist, to create a new zero-length file.
544    * 
545    * @throws LibGuestFSException
546    */
547   public void touch (String path)
548     throws LibGuestFSException
549   {
550     if (g == 0)
551       throw new LibGuestFSException ("touch: handle is closed");
552     _touch (g, path);
553   }
554   private native void _touch (long g, String path)
555     throws LibGuestFSException;
556
557   /**
558    * list the contents of a file
559    *
560    * Return the contents of the file named "path".
561    * 
562    * Note that this function cannot correctly handle binary
563    * files (specifically, files containing "\0" character
564    * which is treated as end of string). For those you need
565    * to use the "g.download" function which has a more
566    * complex interface.
567    * 
568    * Because of the message protocol, there is a transfer
569    * limit of somewhere between 2MB and 4MB. To transfer
570    * large files you should use FTP.
571    * 
572    * @throws LibGuestFSException
573    */
574   public String cat (String path)
575     throws LibGuestFSException
576   {
577     if (g == 0)
578       throw new LibGuestFSException ("cat: handle is closed");
579     return _cat (g, path);
580   }
581   private native String _cat (long g, String path)
582     throws LibGuestFSException;
583
584   /**
585    * list the files in a directory (long format)
586    *
587    * List the files in "directory" (relative to the root
588    * directory, there is no cwd) in the format of 'ls -la'.
589    * 
590    * This command is mostly useful for interactive sessions.
591    * It is *not* intended that you try to parse the output
592    * string.
593    * 
594    * @throws LibGuestFSException
595    */
596   public String ll (String directory)
597     throws LibGuestFSException
598   {
599     if (g == 0)
600       throw new LibGuestFSException ("ll: handle is closed");
601     return _ll (g, directory);
602   }
603   private native String _ll (long g, String directory)
604     throws LibGuestFSException;
605
606   /**
607    * list the files in a directory
608    *
609    * List the files in "directory" (relative to the root
610    * directory, there is no cwd). The '.' and '..' entries
611    * are not returned, but hidden files are shown.
612    * 
613    * This command is mostly useful for interactive sessions.
614    * Programs should probably use "g.readdir" instead.
615    * 
616    * @throws LibGuestFSException
617    */
618   public String[] ls (String directory)
619     throws LibGuestFSException
620   {
621     if (g == 0)
622       throw new LibGuestFSException ("ls: handle is closed");
623     return _ls (g, directory);
624   }
625   private native String[] _ls (long g, String directory)
626     throws LibGuestFSException;
627
628   /**
629    * list the block devices
630    *
631    * List all the block devices.
632    * 
633    * The full block device names are returned, eg. "/dev/sda"
634    * 
635    * @throws LibGuestFSException
636    */
637   public String[] list_devices ()
638     throws LibGuestFSException
639   {
640     if (g == 0)
641       throw new LibGuestFSException ("list_devices: handle is closed");
642     return _list_devices (g);
643   }
644   private native String[] _list_devices (long g)
645     throws LibGuestFSException;
646
647   /**
648    * list the partitions
649    *
650    * List all the partitions detected on all block devices.
651    * 
652    * The full partition device names are returned, eg.
653    * "/dev/sda1"
654    * 
655    * This does not return logical volumes. For that you will
656    * need to call "g.lvs".
657    * 
658    * @throws LibGuestFSException
659    */
660   public String[] list_partitions ()
661     throws LibGuestFSException
662   {
663     if (g == 0)
664       throw new LibGuestFSException ("list_partitions: handle is closed");
665     return _list_partitions (g);
666   }
667   private native String[] _list_partitions (long g)
668     throws LibGuestFSException;
669
670   /**
671    * list the LVM physical volumes (PVs)
672    *
673    * List all the physical volumes detected. This is the
674    * equivalent of the pvs(8) command.
675    * 
676    * This returns a list of just the device names that
677    * contain PVs (eg. "/dev/sda2").
678    * 
679    * See also "g.pvs_full".
680    * 
681    * @throws LibGuestFSException
682    */
683   public String[] pvs ()
684     throws LibGuestFSException
685   {
686     if (g == 0)
687       throw new LibGuestFSException ("pvs: handle is closed");
688     return _pvs (g);
689   }
690   private native String[] _pvs (long g)
691     throws LibGuestFSException;
692
693   /**
694    * list the LVM volume groups (VGs)
695    *
696    * List all the volumes groups detected. This is the
697    * equivalent of the vgs(8) command.
698    * 
699    * This returns a list of just the volume group names that
700    * were detected (eg. "VolGroup00").
701    * 
702    * See also "g.vgs_full".
703    * 
704    * @throws LibGuestFSException
705    */
706   public String[] vgs ()
707     throws LibGuestFSException
708   {
709     if (g == 0)
710       throw new LibGuestFSException ("vgs: handle is closed");
711     return _vgs (g);
712   }
713   private native String[] _vgs (long g)
714     throws LibGuestFSException;
715
716   /**
717    * list the LVM logical volumes (LVs)
718    *
719    * List all the logical volumes detected. This is the
720    * equivalent of the lvs(8) command.
721    * 
722    * This returns a list of the logical volume device names
723    * (eg. "/dev/VolGroup00/LogVol00").
724    * 
725    * See also "g.lvs_full".
726    * 
727    * @throws LibGuestFSException
728    */
729   public String[] lvs ()
730     throws LibGuestFSException
731   {
732     if (g == 0)
733       throw new LibGuestFSException ("lvs: handle is closed");
734     return _lvs (g);
735   }
736   private native String[] _lvs (long g)
737     throws LibGuestFSException;
738
739   /**
740    * list the LVM physical volumes (PVs)
741    *
742    * List all the physical volumes detected. This is the
743    * equivalent of the pvs(8) command. The "full" version
744    * includes all fields.
745    * 
746    * @throws LibGuestFSException
747    */
748   public PV[] pvs_full ()
749     throws LibGuestFSException
750   {
751     if (g == 0)
752       throw new LibGuestFSException ("pvs_full: handle is closed");
753     return _pvs_full (g);
754   }
755   private native PV[] _pvs_full (long g)
756     throws LibGuestFSException;
757
758   /**
759    * list the LVM volume groups (VGs)
760    *
761    * List all the volumes groups detected. This is the
762    * equivalent of the vgs(8) command. The "full" version
763    * includes all fields.
764    * 
765    * @throws LibGuestFSException
766    */
767   public VG[] vgs_full ()
768     throws LibGuestFSException
769   {
770     if (g == 0)
771       throw new LibGuestFSException ("vgs_full: handle is closed");
772     return _vgs_full (g);
773   }
774   private native VG[] _vgs_full (long g)
775     throws LibGuestFSException;
776
777   /**
778    * list the LVM logical volumes (LVs)
779    *
780    * List all the logical volumes detected. This is the
781    * equivalent of the lvs(8) command. The "full" version
782    * includes all fields.
783    * 
784    * @throws LibGuestFSException
785    */
786   public LV[] lvs_full ()
787     throws LibGuestFSException
788   {
789     if (g == 0)
790       throw new LibGuestFSException ("lvs_full: handle is closed");
791     return _lvs_full (g);
792   }
793   private native LV[] _lvs_full (long g)
794     throws LibGuestFSException;
795
796   /**
797    * read file as lines
798    *
799    * Return the contents of the file named "path".
800    * 
801    * The file contents are returned as a list of lines.
802    * Trailing "LF" and "CRLF" character sequences are *not*
803    * returned.
804    * 
805    * Note that this function cannot correctly handle binary
806    * files (specifically, files containing "\0" character
807    * which is treated as end of line). For those you need to
808    * use the "g.read_file" function which has a more complex
809    * interface.
810    * 
811    * @throws LibGuestFSException
812    */
813   public String[] read_lines (String path)
814     throws LibGuestFSException
815   {
816     if (g == 0)
817       throw new LibGuestFSException ("read_lines: handle is closed");
818     return _read_lines (g, path);
819   }
820   private native String[] _read_lines (long g, String path)
821     throws LibGuestFSException;
822
823   /**
824    * create a new Augeas handle
825    *
826    * Create a new Augeas handle for editing configuration
827    * files. If there was any previous Augeas handle
828    * associated with this guestfs session, then it is closed.
829    * 
830    * You must call this before using any other "g.aug_*"
831    * commands.
832    * 
833    * "root" is the filesystem root. "root" must not be NULL,
834    * use "/" instead.
835    * 
836    * The flags are the same as the flags defined in
837    * <augeas.h>, the logical *or* of the following integers:
838    * 
839    * "AUG_SAVE_BACKUP" = 1
840    * Keep the original file with a ".augsave" extension.
841    * 
842    * "AUG_SAVE_NEWFILE" = 2
843    * Save changes into a file with extension ".augnew",
844    * and do not overwrite original. Overrides
845    * "AUG_SAVE_BACKUP".
846    * 
847    * "AUG_TYPE_CHECK" = 4
848    * Typecheck lenses (can be expensive).
849    * 
850    * "AUG_NO_STDINC" = 8
851    * Do not use standard load path for modules.
852    * 
853    * "AUG_SAVE_NOOP" = 16
854    * Make save a no-op, just record what would have been
855    * changed.
856    * 
857    * "AUG_NO_LOAD" = 32
858    * Do not load the tree in "g.aug_init".
859    * 
860    * To close the handle, you can call "g.aug_close".
861    * 
862    * To find out more about Augeas, see <http://augeas.net/>.
863    * 
864    * @throws LibGuestFSException
865    */
866   public void aug_init (String root, int flags)
867     throws LibGuestFSException
868   {
869     if (g == 0)
870       throw new LibGuestFSException ("aug_init: handle is closed");
871     _aug_init (g, root, flags);
872   }
873   private native void _aug_init (long g, String root, int flags)
874     throws LibGuestFSException;
875
876   /**
877    * close the current Augeas handle
878    *
879    * Close the current Augeas handle and free up any
880    * resources used by it. After calling this, you have to
881    * call "g.aug_init" again before you can use any other
882    * Augeas functions.
883    * 
884    * @throws LibGuestFSException
885    */
886   public void aug_close ()
887     throws LibGuestFSException
888   {
889     if (g == 0)
890       throw new LibGuestFSException ("aug_close: handle is closed");
891     _aug_close (g);
892   }
893   private native void _aug_close (long g)
894     throws LibGuestFSException;
895
896   /**
897    * define an Augeas variable
898    *
899    * Defines an Augeas variable "name" whose value is the
900    * result of evaluating "expr". If "expr" is NULL, then
901    * "name" is undefined.
902    * 
903    * On success this returns the number of nodes in "expr",
904    * or 0 if "expr" evaluates to something which is not a
905    * nodeset.
906    * 
907    * @throws LibGuestFSException
908    */
909   public int aug_defvar (String name, String expr)
910     throws LibGuestFSException
911   {
912     if (g == 0)
913       throw new LibGuestFSException ("aug_defvar: handle is closed");
914     return _aug_defvar (g, name, expr);
915   }
916   private native int _aug_defvar (long g, String name, String expr)
917     throws LibGuestFSException;
918
919   /**
920    * define an Augeas node
921    *
922    * Defines a variable "name" whose value is the result of
923    * evaluating "expr".
924    * 
925    * If "expr" evaluates to an empty nodeset, a node is
926    * created, equivalent to calling "g.aug_set" "expr",
927    * "value". "name" will be the nodeset containing that
928    * single node.
929    * 
930    * On success this returns a pair containing the number of
931    * nodes in the nodeset, and a boolean flag if a node was
932    * created.
933    * 
934    * @throws LibGuestFSException
935    */
936   public IntBool aug_defnode (String name, String expr, String val)
937     throws LibGuestFSException
938   {
939     if (g == 0)
940       throw new LibGuestFSException ("aug_defnode: handle is closed");
941     return _aug_defnode (g, name, expr, val);
942   }
943   private native IntBool _aug_defnode (long g, String name, String expr, String val)
944     throws LibGuestFSException;
945
946   /**
947    * look up the value of an Augeas path
948    *
949    * Look up the value associated with "path". If "path"
950    * matches exactly one node, the "value" is returned.
951    * 
952    * @throws LibGuestFSException
953    */
954   public String aug_get (String path)
955     throws LibGuestFSException
956   {
957     if (g == 0)
958       throw new LibGuestFSException ("aug_get: handle is closed");
959     return _aug_get (g, path);
960   }
961   private native String _aug_get (long g, String path)
962     throws LibGuestFSException;
963
964   /**
965    * set Augeas path to value
966    *
967    * Set the value associated with "path" to "value".
968    * 
969    * @throws LibGuestFSException
970    */
971   public void aug_set (String path, String val)
972     throws LibGuestFSException
973   {
974     if (g == 0)
975       throw new LibGuestFSException ("aug_set: handle is closed");
976     _aug_set (g, path, val);
977   }
978   private native void _aug_set (long g, String path, String val)
979     throws LibGuestFSException;
980
981   /**
982    * insert a sibling Augeas node
983    *
984    * Create a new sibling "label" for "path", inserting it
985    * into the tree before or after "path" (depending on the
986    * boolean flag "before").
987    * 
988    * "path" must match exactly one existing node in the tree,
989    * and "label" must be a label, ie. not contain "/", "*" or
990    * end with a bracketed index "[N]".
991    * 
992    * @throws LibGuestFSException
993    */
994   public void aug_insert (String path, String label, boolean before)
995     throws LibGuestFSException
996   {
997     if (g == 0)
998       throw new LibGuestFSException ("aug_insert: handle is closed");
999     _aug_insert (g, path, label, before);
1000   }
1001   private native void _aug_insert (long g, String path, String label, boolean before)
1002     throws LibGuestFSException;
1003
1004   /**
1005    * remove an Augeas path
1006    *
1007    * Remove "path" and all of its children.
1008    * 
1009    * On success this returns the number of entries which were
1010    * removed.
1011    * 
1012    * @throws LibGuestFSException
1013    */
1014   public int aug_rm (String path)
1015     throws LibGuestFSException
1016   {
1017     if (g == 0)
1018       throw new LibGuestFSException ("aug_rm: handle is closed");
1019     return _aug_rm (g, path);
1020   }
1021   private native int _aug_rm (long g, String path)
1022     throws LibGuestFSException;
1023
1024   /**
1025    * move Augeas node
1026    *
1027    * Move the node "src" to "dest". "src" must match exactly
1028    * one node. "dest" is overwritten if it exists.
1029    * 
1030    * @throws LibGuestFSException
1031    */
1032   public void aug_mv (String src, String dest)
1033     throws LibGuestFSException
1034   {
1035     if (g == 0)
1036       throw new LibGuestFSException ("aug_mv: handle is closed");
1037     _aug_mv (g, src, dest);
1038   }
1039   private native void _aug_mv (long g, String src, String dest)
1040     throws LibGuestFSException;
1041
1042   /**
1043    * return Augeas nodes which match path
1044    *
1045    * Returns a list of paths which match the path expression
1046    * "path". The returned paths are sufficiently qualified so
1047    * that they match exactly one node in the current tree.
1048    * 
1049    * @throws LibGuestFSException
1050    */
1051   public String[] aug_match (String path)
1052     throws LibGuestFSException
1053   {
1054     if (g == 0)
1055       throw new LibGuestFSException ("aug_match: handle is closed");
1056     return _aug_match (g, path);
1057   }
1058   private native String[] _aug_match (long g, String path)
1059     throws LibGuestFSException;
1060
1061   /**
1062    * write all pending Augeas changes to disk
1063    *
1064    * This writes all pending changes to disk.
1065    * 
1066    * The flags which were passed to "g.aug_init" affect
1067    * exactly how files are saved.
1068    * 
1069    * @throws LibGuestFSException
1070    */
1071   public void aug_save ()
1072     throws LibGuestFSException
1073   {
1074     if (g == 0)
1075       throw new LibGuestFSException ("aug_save: handle is closed");
1076     _aug_save (g);
1077   }
1078   private native void _aug_save (long g)
1079     throws LibGuestFSException;
1080
1081   /**
1082    * load files into the tree
1083    *
1084    * Load files into the tree.
1085    * 
1086    * See "aug_load" in the Augeas documentation for the full
1087    * gory details.
1088    * 
1089    * @throws LibGuestFSException
1090    */
1091   public void aug_load ()
1092     throws LibGuestFSException
1093   {
1094     if (g == 0)
1095       throw new LibGuestFSException ("aug_load: handle is closed");
1096     _aug_load (g);
1097   }
1098   private native void _aug_load (long g)
1099     throws LibGuestFSException;
1100
1101   /**
1102    * list Augeas nodes under a path
1103    *
1104    * This is just a shortcut for listing "g.aug_match"
1105    * "path/*" and sorting the resulting nodes into
1106    * alphabetical order.
1107    * 
1108    * @throws LibGuestFSException
1109    */
1110   public String[] aug_ls (String path)
1111     throws LibGuestFSException
1112   {
1113     if (g == 0)
1114       throw new LibGuestFSException ("aug_ls: handle is closed");
1115     return _aug_ls (g, path);
1116   }
1117   private native String[] _aug_ls (long g, String path)
1118     throws LibGuestFSException;
1119
1120   /**
1121    * remove a file
1122    *
1123    * Remove the single file "path".
1124    * 
1125    * @throws LibGuestFSException
1126    */
1127   public void rm (String path)
1128     throws LibGuestFSException
1129   {
1130     if (g == 0)
1131       throw new LibGuestFSException ("rm: handle is closed");
1132     _rm (g, path);
1133   }
1134   private native void _rm (long g, String path)
1135     throws LibGuestFSException;
1136
1137   /**
1138    * remove a directory
1139    *
1140    * Remove the single directory "path".
1141    * 
1142    * @throws LibGuestFSException
1143    */
1144   public void rmdir (String path)
1145     throws LibGuestFSException
1146   {
1147     if (g == 0)
1148       throw new LibGuestFSException ("rmdir: handle is closed");
1149     _rmdir (g, path);
1150   }
1151   private native void _rmdir (long g, String path)
1152     throws LibGuestFSException;
1153
1154   /**
1155    * remove a file or directory recursively
1156    *
1157    * Remove the file or directory "path", recursively
1158    * removing the contents if its a directory. This is like
1159    * the "rm -rf" shell command.
1160    * 
1161    * @throws LibGuestFSException
1162    */
1163   public void rm_rf (String path)
1164     throws LibGuestFSException
1165   {
1166     if (g == 0)
1167       throw new LibGuestFSException ("rm_rf: handle is closed");
1168     _rm_rf (g, path);
1169   }
1170   private native void _rm_rf (long g, String path)
1171     throws LibGuestFSException;
1172
1173   /**
1174    * create a directory
1175    *
1176    * Create a directory named "path".
1177    * 
1178    * @throws LibGuestFSException
1179    */
1180   public void mkdir (String path)
1181     throws LibGuestFSException
1182   {
1183     if (g == 0)
1184       throw new LibGuestFSException ("mkdir: handle is closed");
1185     _mkdir (g, path);
1186   }
1187   private native void _mkdir (long g, String path)
1188     throws LibGuestFSException;
1189
1190   /**
1191    * create a directory and parents
1192    *
1193    * Create a directory named "path", creating any parent
1194    * directories as necessary. This is like the "mkdir -p"
1195    * shell command.
1196    * 
1197    * @throws LibGuestFSException
1198    */
1199   public void mkdir_p (String path)
1200     throws LibGuestFSException
1201   {
1202     if (g == 0)
1203       throw new LibGuestFSException ("mkdir_p: handle is closed");
1204     _mkdir_p (g, path);
1205   }
1206   private native void _mkdir_p (long g, String path)
1207     throws LibGuestFSException;
1208
1209   /**
1210    * change file mode
1211    *
1212    * Change the mode (permissions) of "path" to "mode". Only
1213    * numeric modes are supported.
1214    * 
1215    * @throws LibGuestFSException
1216    */
1217   public void chmod (int mode, String path)
1218     throws LibGuestFSException
1219   {
1220     if (g == 0)
1221       throw new LibGuestFSException ("chmod: handle is closed");
1222     _chmod (g, mode, path);
1223   }
1224   private native void _chmod (long g, int mode, String path)
1225     throws LibGuestFSException;
1226
1227   /**
1228    * change file owner and group
1229    *
1230    * Change the file owner to "owner" and group to "group".
1231    * 
1232    * Only numeric uid and gid are supported. If you want to
1233    * use names, you will need to locate and parse the
1234    * password file yourself (Augeas support makes this
1235    * relatively easy).
1236    * 
1237    * @throws LibGuestFSException
1238    */
1239   public void chown (int owner, int group, String path)
1240     throws LibGuestFSException
1241   {
1242     if (g == 0)
1243       throw new LibGuestFSException ("chown: handle is closed");
1244     _chown (g, owner, group, path);
1245   }
1246   private native void _chown (long g, int owner, int group, String path)
1247     throws LibGuestFSException;
1248
1249   /**
1250    * test if file or directory exists
1251    *
1252    * This returns "true" if and only if there is a file,
1253    * directory (or anything) with the given "path" name.
1254    * 
1255    * See also "g.is_file", "g.is_dir", "g.stat".
1256    * 
1257    * @throws LibGuestFSException
1258    */
1259   public boolean exists (String path)
1260     throws LibGuestFSException
1261   {
1262     if (g == 0)
1263       throw new LibGuestFSException ("exists: handle is closed");
1264     return _exists (g, path);
1265   }
1266   private native boolean _exists (long g, String path)
1267     throws LibGuestFSException;
1268
1269   /**
1270    * test if file exists
1271    *
1272    * This returns "true" if and only if there is a file with
1273    * the given "path" name. Note that it returns false for
1274    * other objects like directories.
1275    * 
1276    * See also "g.stat".
1277    * 
1278    * @throws LibGuestFSException
1279    */
1280   public boolean is_file (String path)
1281     throws LibGuestFSException
1282   {
1283     if (g == 0)
1284       throw new LibGuestFSException ("is_file: handle is closed");
1285     return _is_file (g, path);
1286   }
1287   private native boolean _is_file (long g, String path)
1288     throws LibGuestFSException;
1289
1290   /**
1291    * test if file exists
1292    *
1293    * This returns "true" if and only if there is a directory
1294    * with the given "path" name. Note that it returns false
1295    * for other objects like files.
1296    * 
1297    * See also "g.stat".
1298    * 
1299    * @throws LibGuestFSException
1300    */
1301   public boolean is_dir (String path)
1302     throws LibGuestFSException
1303   {
1304     if (g == 0)
1305       throw new LibGuestFSException ("is_dir: handle is closed");
1306     return _is_dir (g, path);
1307   }
1308   private native boolean _is_dir (long g, String path)
1309     throws LibGuestFSException;
1310
1311   /**
1312    * create an LVM physical volume
1313    *
1314    * This creates an LVM physical volume on the named
1315    * "device", where "device" should usually be a partition
1316    * name such as "/dev/sda1".
1317    * 
1318    * @throws LibGuestFSException
1319    */
1320   public void pvcreate (String device)
1321     throws LibGuestFSException
1322   {
1323     if (g == 0)
1324       throw new LibGuestFSException ("pvcreate: handle is closed");
1325     _pvcreate (g, device);
1326   }
1327   private native void _pvcreate (long g, String device)
1328     throws LibGuestFSException;
1329
1330   /**
1331    * create an LVM volume group
1332    *
1333    * This creates an LVM volume group called "volgroup" from
1334    * the non-empty list of physical volumes "physvols".
1335    * 
1336    * @throws LibGuestFSException
1337    */
1338   public void vgcreate (String volgroup, String[] physvols)
1339     throws LibGuestFSException
1340   {
1341     if (g == 0)
1342       throw new LibGuestFSException ("vgcreate: handle is closed");
1343     _vgcreate (g, volgroup, physvols);
1344   }
1345   private native void _vgcreate (long g, String volgroup, String[] physvols)
1346     throws LibGuestFSException;
1347
1348   /**
1349    * create an LVM volume group
1350    *
1351    * This creates an LVM volume group called "logvol" on the
1352    * volume group "volgroup", with "size" megabytes.
1353    * 
1354    * @throws LibGuestFSException
1355    */
1356   public void lvcreate (String logvol, String volgroup, int mbytes)
1357     throws LibGuestFSException
1358   {
1359     if (g == 0)
1360       throw new LibGuestFSException ("lvcreate: handle is closed");
1361     _lvcreate (g, logvol, volgroup, mbytes);
1362   }
1363   private native void _lvcreate (long g, String logvol, String volgroup, int mbytes)
1364     throws LibGuestFSException;
1365
1366   /**
1367    * make a filesystem
1368    *
1369    * This creates a filesystem on "device" (usually a
1370    * partition of LVM logical volume). The filesystem type is
1371    * "fstype", for example "ext3".
1372    * 
1373    * @throws LibGuestFSException
1374    */
1375   public void mkfs (String fstype, String device)
1376     throws LibGuestFSException
1377   {
1378     if (g == 0)
1379       throw new LibGuestFSException ("mkfs: handle is closed");
1380     _mkfs (g, fstype, device);
1381   }
1382   private native void _mkfs (long g, String fstype, String device)
1383     throws LibGuestFSException;
1384
1385   /**
1386    * create partitions on a block device
1387    *
1388    * This is a direct interface to the sfdisk(8) program for
1389    * creating partitions on block devices.
1390    * 
1391    * "device" should be a block device, for example
1392    * "/dev/sda".
1393    * 
1394    * "cyls", "heads" and "sectors" are the number of
1395    * cylinders, heads and sectors on the device, which are
1396    * passed directly to sfdisk as the *-C*, *-H* and *-S*
1397    * parameters. If you pass 0 for any of these, then the
1398    * corresponding parameter is omitted. Usually for 'large'
1399    * disks, you can just pass 0 for these, but for small
1400    * (floppy-sized) disks, sfdisk (or rather, the kernel)
1401    * cannot work out the right geometry and you will need to
1402    * tell it.
1403    * 
1404    * "lines" is a list of lines that we feed to "sfdisk". For
1405    * more information refer to the sfdisk(8) manpage.
1406    * 
1407    * To create a single partition occupying the whole disk,
1408    * you would pass "lines" as a single element list, when
1409    * the single element being the string "," (comma).
1410    * 
1411    * This command is dangerous. Without careful use you can
1412    * easily destroy all your data.
1413    * 
1414    * @throws LibGuestFSException
1415    */
1416   public void sfdisk (String device, int cyls, int heads, int sectors, String[] lines)
1417     throws LibGuestFSException
1418   {
1419     if (g == 0)
1420       throw new LibGuestFSException ("sfdisk: handle is closed");
1421     _sfdisk (g, device, cyls, heads, sectors, lines);
1422   }
1423   private native void _sfdisk (long g, String device, int cyls, int heads, int sectors, String[] lines)
1424     throws LibGuestFSException;
1425
1426   /**
1427    * create a file
1428    *
1429    * This call creates a file called "path". The contents of
1430    * the file is the string "content" (which can contain any
1431    * 8 bit data), with length "size".
1432    * 
1433    * As a special case, if "size" is 0 then the length is
1434    * calculated using "strlen" (so in this case the content
1435    * cannot contain embedded ASCII NULs).
1436    * 
1437    * Because of the message protocol, there is a transfer
1438    * limit of somewhere between 2MB and 4MB. To transfer
1439    * large files you should use FTP.
1440    * 
1441    * @throws LibGuestFSException
1442    */
1443   public void write_file (String path, String content, int size)
1444     throws LibGuestFSException
1445   {
1446     if (g == 0)
1447       throw new LibGuestFSException ("write_file: handle is closed");
1448     _write_file (g, path, content, size);
1449   }
1450   private native void _write_file (long g, String path, String content, int size)
1451     throws LibGuestFSException;
1452
1453   /**
1454    * unmount a filesystem
1455    *
1456    * This unmounts the given filesystem. The filesystem may
1457    * be specified either by its mountpoint (path) or the
1458    * device which contains the filesystem.
1459    * 
1460    * @throws LibGuestFSException
1461    */
1462   public void umount (String pathordevice)
1463     throws LibGuestFSException
1464   {
1465     if (g == 0)
1466       throw new LibGuestFSException ("umount: handle is closed");
1467     _umount (g, pathordevice);
1468   }
1469   private native void _umount (long g, String pathordevice)
1470     throws LibGuestFSException;
1471
1472   /**
1473    * show mounted filesystems
1474    *
1475    * This returns the list of currently mounted filesystems.
1476    * It returns the list of devices (eg. "/dev/sda1",
1477    * "/dev/VG/LV").
1478    * 
1479    * Some internal mounts are not shown.
1480    * 
1481    * @throws LibGuestFSException
1482    */
1483   public String[] mounts ()
1484     throws LibGuestFSException
1485   {
1486     if (g == 0)
1487       throw new LibGuestFSException ("mounts: handle is closed");
1488     return _mounts (g);
1489   }
1490   private native String[] _mounts (long g)
1491     throws LibGuestFSException;
1492
1493   /**
1494    * unmount all filesystems
1495    *
1496    * This unmounts all mounted filesystems.
1497    * 
1498    * Some internal mounts are not unmounted by this call.
1499    * 
1500    * @throws LibGuestFSException
1501    */
1502   public void umount_all ()
1503     throws LibGuestFSException
1504   {
1505     if (g == 0)
1506       throw new LibGuestFSException ("umount_all: handle is closed");
1507     _umount_all (g);
1508   }
1509   private native void _umount_all (long g)
1510     throws LibGuestFSException;
1511
1512   /**
1513    * remove all LVM LVs, VGs and PVs
1514    *
1515    * This command removes all LVM logical volumes, volume
1516    * groups and physical volumes.
1517    * 
1518    * This command is dangerous. Without careful use you can
1519    * easily destroy all your data.
1520    * 
1521    * @throws LibGuestFSException
1522    */
1523   public void lvm_remove_all ()
1524     throws LibGuestFSException
1525   {
1526     if (g == 0)
1527       throw new LibGuestFSException ("lvm_remove_all: handle is closed");
1528     _lvm_remove_all (g);
1529   }
1530   private native void _lvm_remove_all (long g)
1531     throws LibGuestFSException;
1532
1533   /**
1534    * determine file type
1535    *
1536    * This call uses the standard file(1) command to determine
1537    * the type or contents of the file. This also works on
1538    * devices, for example to find out whether a partition
1539    * contains a filesystem.
1540    * 
1541    * The exact command which runs is "file -bsL path". Note
1542    * in particular that the filename is not prepended to the
1543    * output (the "-b" option).
1544    * 
1545    * @throws LibGuestFSException
1546    */
1547   public String file (String path)
1548     throws LibGuestFSException
1549   {
1550     if (g == 0)
1551       throw new LibGuestFSException ("file: handle is closed");
1552     return _file (g, path);
1553   }
1554   private native String _file (long g, String path)
1555     throws LibGuestFSException;
1556
1557   /**
1558    * run a command from the guest filesystem
1559    *
1560    * This call runs a command from the guest filesystem. The
1561    * filesystem must be mounted, and must contain a
1562    * compatible operating system (ie. something Linux, with
1563    * the same or compatible processor architecture).
1564    * 
1565    * The single parameter is an argv-style list of arguments.
1566    * The first element is the name of the program to run.
1567    * Subsequent elements are parameters. The list must be
1568    * non-empty (ie. must contain a program name).
1569    * 
1570    * The $PATH environment variable will contain at least
1571    * "/usr/bin" and "/bin". If you require a program from
1572    * another location, you should provide the full path in
1573    * the first parameter.
1574    * 
1575    * Shared libraries and data files required by the program
1576    * must be available on filesystems which are mounted in
1577    * the correct places. It is the caller's responsibility to
1578    * ensure all filesystems that are needed are mounted at
1579    * the right locations.
1580    * 
1581    * @throws LibGuestFSException
1582    */
1583   public String command (String[] arguments)
1584     throws LibGuestFSException
1585   {
1586     if (g == 0)
1587       throw new LibGuestFSException ("command: handle is closed");
1588     return _command (g, arguments);
1589   }
1590   private native String _command (long g, String[] arguments)
1591     throws LibGuestFSException;
1592
1593   /**
1594    * run a command, returning lines
1595    *
1596    * This is the same as "g.command", but splits the result
1597    * into a list of lines.
1598    * 
1599    * @throws LibGuestFSException
1600    */
1601   public String[] command_lines (String[] arguments)
1602     throws LibGuestFSException
1603   {
1604     if (g == 0)
1605       throw new LibGuestFSException ("command_lines: handle is closed");
1606     return _command_lines (g, arguments);
1607   }
1608   private native String[] _command_lines (long g, String[] arguments)
1609     throws LibGuestFSException;
1610
1611   /**
1612    * get file information
1613    *
1614    * Returns file information for the given "path".
1615    * 
1616    * This is the same as the stat(2) system call.
1617    * 
1618    * @throws LibGuestFSException
1619    */
1620   public Stat stat (String path)
1621     throws LibGuestFSException
1622   {
1623     if (g == 0)
1624       throw new LibGuestFSException ("stat: handle is closed");
1625     return _stat (g, path);
1626   }
1627   private native Stat _stat (long g, String path)
1628     throws LibGuestFSException;
1629
1630   /**
1631    * get file information for a symbolic link
1632    *
1633    * Returns file information for the given "path".
1634    * 
1635    * This is the same as "g.stat" except that if "path" is a
1636    * symbolic link, then the link is stat-ed, not the file it
1637    * refers to.
1638    * 
1639    * This is the same as the lstat(2) system call.
1640    * 
1641    * @throws LibGuestFSException
1642    */
1643   public Stat lstat (String path)
1644     throws LibGuestFSException
1645   {
1646     if (g == 0)
1647       throw new LibGuestFSException ("lstat: handle is closed");
1648     return _lstat (g, path);
1649   }
1650   private native Stat _lstat (long g, String path)
1651     throws LibGuestFSException;
1652
1653   /**
1654    * get file system statistics
1655    *
1656    * Returns file system statistics for any mounted file
1657    * system. "path" should be a file or directory in the
1658    * mounted file system (typically it is the mount point
1659    * itself, but it doesn't need to be).
1660    * 
1661    * This is the same as the statvfs(2) system call.
1662    * 
1663    * @throws LibGuestFSException
1664    */
1665   public StatVFS statvfs (String path)
1666     throws LibGuestFSException
1667   {
1668     if (g == 0)
1669       throw new LibGuestFSException ("statvfs: handle is closed");
1670     return _statvfs (g, path);
1671   }
1672   private native StatVFS _statvfs (long g, String path)
1673     throws LibGuestFSException;
1674
1675   /**
1676    * get ext2/ext3 superblock details
1677    *
1678    * This returns the contents of the ext2 or ext3 filesystem
1679    * superblock on "device".
1680    * 
1681    * It is the same as running "tune2fs -l device". See
1682    * tune2fs(8) manpage for more details. The list of fields
1683    * returned isn't clearly defined, and depends on both the
1684    * version of "tune2fs" that libguestfs was built against,
1685    * and the filesystem itself.
1686    * 
1687    * @throws LibGuestFSException
1688    */
1689   public HashMap<String,String> tune2fs_l (String device)
1690     throws LibGuestFSException
1691   {
1692     if (g == 0)
1693       throw new LibGuestFSException ("tune2fs_l: handle is closed");
1694     return _tune2fs_l (g, device);
1695   }
1696   private native HashMap<String,String> _tune2fs_l (long g, String device)
1697     throws LibGuestFSException;
1698
1699   /**
1700    * set block device to read-only
1701    *
1702    * Sets the block device named "device" to read-only.
1703    * 
1704    * This uses the blockdev(8) command.
1705    * 
1706    * @throws LibGuestFSException
1707    */
1708   public void blockdev_setro (String device)
1709     throws LibGuestFSException
1710   {
1711     if (g == 0)
1712       throw new LibGuestFSException ("blockdev_setro: handle is closed");
1713     _blockdev_setro (g, device);
1714   }
1715   private native void _blockdev_setro (long g, String device)
1716     throws LibGuestFSException;
1717
1718   /**
1719    * set block device to read-write
1720    *
1721    * Sets the block device named "device" to read-write.
1722    * 
1723    * This uses the blockdev(8) command.
1724    * 
1725    * @throws LibGuestFSException
1726    */
1727   public void blockdev_setrw (String device)
1728     throws LibGuestFSException
1729   {
1730     if (g == 0)
1731       throw new LibGuestFSException ("blockdev_setrw: handle is closed");
1732     _blockdev_setrw (g, device);
1733   }
1734   private native void _blockdev_setrw (long g, String device)
1735     throws LibGuestFSException;
1736
1737   /**
1738    * is block device set to read-only
1739    *
1740    * Returns a boolean indicating if the block device is
1741    * read-only (true if read-only, false if not).
1742    * 
1743    * This uses the blockdev(8) command.
1744    * 
1745    * @throws LibGuestFSException
1746    */
1747   public boolean blockdev_getro (String device)
1748     throws LibGuestFSException
1749   {
1750     if (g == 0)
1751       throw new LibGuestFSException ("blockdev_getro: handle is closed");
1752     return _blockdev_getro (g, device);
1753   }
1754   private native boolean _blockdev_getro (long g, String device)
1755     throws LibGuestFSException;
1756
1757   /**
1758    * get sectorsize of block device
1759    *
1760    * This returns the size of sectors on a block device.
1761    * Usually 512, but can be larger for modern devices.
1762    * 
1763    * (Note, this is not the size in sectors, use
1764    * "g.blockdev_getsz" for that).
1765    * 
1766    * This uses the blockdev(8) command.
1767    * 
1768    * @throws LibGuestFSException
1769    */
1770   public int blockdev_getss (String device)
1771     throws LibGuestFSException
1772   {
1773     if (g == 0)
1774       throw new LibGuestFSException ("blockdev_getss: handle is closed");
1775     return _blockdev_getss (g, device);
1776   }
1777   private native int _blockdev_getss (long g, String device)
1778     throws LibGuestFSException;
1779
1780   /**
1781    * get blocksize of block device
1782    *
1783    * This returns the block size of a device.
1784    * 
1785    * (Note this is different from both *size in blocks* and
1786    * *filesystem block size*).
1787    * 
1788    * This uses the blockdev(8) command.
1789    * 
1790    * @throws LibGuestFSException
1791    */
1792   public int blockdev_getbsz (String device)
1793     throws LibGuestFSException
1794   {
1795     if (g == 0)
1796       throw new LibGuestFSException ("blockdev_getbsz: handle is closed");
1797     return _blockdev_getbsz (g, device);
1798   }
1799   private native int _blockdev_getbsz (long g, String device)
1800     throws LibGuestFSException;
1801
1802   /**
1803    * set blocksize of block device
1804    *
1805    * This sets the block size of a device.
1806    * 
1807    * (Note this is different from both *size in blocks* and
1808    * *filesystem block size*).
1809    * 
1810    * This uses the blockdev(8) command.
1811    * 
1812    * @throws LibGuestFSException
1813    */
1814   public void blockdev_setbsz (String device, int blocksize)
1815     throws LibGuestFSException
1816   {
1817     if (g == 0)
1818       throw new LibGuestFSException ("blockdev_setbsz: handle is closed");
1819     _blockdev_setbsz (g, device, blocksize);
1820   }
1821   private native void _blockdev_setbsz (long g, String device, int blocksize)
1822     throws LibGuestFSException;
1823
1824   /**
1825    * get total size of device in 512-byte sectors
1826    *
1827    * This returns the size of the device in units of 512-byte
1828    * sectors (even if the sectorsize isn't 512 bytes ...
1829    * weird).
1830    * 
1831    * See also "g.blockdev_getss" for the real sector size of
1832    * the device, and "g.blockdev_getsize64" for the more
1833    * useful *size in bytes*.
1834    * 
1835    * This uses the blockdev(8) command.
1836    * 
1837    * @throws LibGuestFSException
1838    */
1839   public long blockdev_getsz (String device)
1840     throws LibGuestFSException
1841   {
1842     if (g == 0)
1843       throw new LibGuestFSException ("blockdev_getsz: handle is closed");
1844     return _blockdev_getsz (g, device);
1845   }
1846   private native long _blockdev_getsz (long g, String device)
1847     throws LibGuestFSException;
1848
1849   /**
1850    * get total size of device in bytes
1851    *
1852    * This returns the size of the device in bytes.
1853    * 
1854    * See also "g.blockdev_getsz".
1855    * 
1856    * This uses the blockdev(8) command.
1857    * 
1858    * @throws LibGuestFSException
1859    */
1860   public long blockdev_getsize64 (String device)
1861     throws LibGuestFSException
1862   {
1863     if (g == 0)
1864       throw new LibGuestFSException ("blockdev_getsize64: handle is closed");
1865     return _blockdev_getsize64 (g, device);
1866   }
1867   private native long _blockdev_getsize64 (long g, String device)
1868     throws LibGuestFSException;
1869
1870   /**
1871    * flush device buffers
1872    *
1873    * This tells the kernel to flush internal buffers
1874    * associated with "device".
1875    * 
1876    * This uses the blockdev(8) command.
1877    * 
1878    * @throws LibGuestFSException
1879    */
1880   public void blockdev_flushbufs (String device)
1881     throws LibGuestFSException
1882   {
1883     if (g == 0)
1884       throw new LibGuestFSException ("blockdev_flushbufs: handle is closed");
1885     _blockdev_flushbufs (g, device);
1886   }
1887   private native void _blockdev_flushbufs (long g, String device)
1888     throws LibGuestFSException;
1889
1890   /**
1891    * reread partition table
1892    *
1893    * Reread the partition table on "device".
1894    * 
1895    * This uses the blockdev(8) command.
1896    * 
1897    * @throws LibGuestFSException
1898    */
1899   public void blockdev_rereadpt (String device)
1900     throws LibGuestFSException
1901   {
1902     if (g == 0)
1903       throw new LibGuestFSException ("blockdev_rereadpt: handle is closed");
1904     _blockdev_rereadpt (g, device);
1905   }
1906   private native void _blockdev_rereadpt (long g, String device)
1907     throws LibGuestFSException;
1908
1909   /**
1910    * upload a file from the local machine
1911    *
1912    * Upload local file "filename" to "remotefilename" on the
1913    * filesystem.
1914    * 
1915    * "filename" can also be a named pipe.
1916    * 
1917    * See also "g.download".
1918    * 
1919    * @throws LibGuestFSException
1920    */
1921   public void upload (String filename, String remotefilename)
1922     throws LibGuestFSException
1923   {
1924     if (g == 0)
1925       throw new LibGuestFSException ("upload: handle is closed");
1926     _upload (g, filename, remotefilename);
1927   }
1928   private native void _upload (long g, String filename, String remotefilename)
1929     throws LibGuestFSException;
1930
1931   /**
1932    * download a file to the local machine
1933    *
1934    * Download file "remotefilename" and save it as "filename"
1935    * on the local machine.
1936    * 
1937    * "filename" can also be a named pipe.
1938    * 
1939    * See also "g.upload", "g.cat".
1940    * 
1941    * @throws LibGuestFSException
1942    */
1943   public void download (String remotefilename, String filename)
1944     throws LibGuestFSException
1945   {
1946     if (g == 0)
1947       throw new LibGuestFSException ("download: handle is closed");
1948     _download (g, remotefilename, filename);
1949   }
1950   private native void _download (long g, String remotefilename, String filename)
1951     throws LibGuestFSException;
1952
1953   /**
1954    * compute MD5, SHAx or CRC checksum of file
1955    *
1956    * This call computes the MD5, SHAx or CRC checksum of the
1957    * file named "path".
1958    * 
1959    * The type of checksum to compute is given by the
1960    * "csumtype" parameter which must have one of the
1961    * following values:
1962    * 
1963    * "crc"
1964    * Compute the cyclic redundancy check (CRC) specified
1965    * by POSIX for the "cksum" command.
1966    * 
1967    * "md5"
1968    * Compute the MD5 hash (using the "md5sum" program).
1969    * 
1970    * "sha1"
1971    * Compute the SHA1 hash (using the "sha1sum" program).
1972    * 
1973    * "sha224"
1974    * Compute the SHA224 hash (using the "sha224sum"
1975    * program).
1976    * 
1977    * "sha256"
1978    * Compute the SHA256 hash (using the "sha256sum"
1979    * program).
1980    * 
1981    * "sha384"
1982    * Compute the SHA384 hash (using the "sha384sum"
1983    * program).
1984    * 
1985    * "sha512"
1986    * Compute the SHA512 hash (using the "sha512sum"
1987    * program).
1988    * 
1989    * The checksum is returned as a printable string.
1990    * 
1991    * @throws LibGuestFSException
1992    */
1993   public String checksum (String csumtype, String path)
1994     throws LibGuestFSException
1995   {
1996     if (g == 0)
1997       throw new LibGuestFSException ("checksum: handle is closed");
1998     return _checksum (g, csumtype, path);
1999   }
2000   private native String _checksum (long g, String csumtype, String path)
2001     throws LibGuestFSException;
2002
2003   /**
2004    * unpack tarfile to directory
2005    *
2006    * This command uploads and unpacks local file "tarfile"
2007    * (an *uncompressed* tar file) into "directory".
2008    * 
2009    * To upload a compressed tarball, use "g.tgz_in".
2010    * 
2011    * @throws LibGuestFSException
2012    */
2013   public void tar_in (String tarfile, String directory)
2014     throws LibGuestFSException
2015   {
2016     if (g == 0)
2017       throw new LibGuestFSException ("tar_in: handle is closed");
2018     _tar_in (g, tarfile, directory);
2019   }
2020   private native void _tar_in (long g, String tarfile, String directory)
2021     throws LibGuestFSException;
2022
2023   /**
2024    * pack directory into tarfile
2025    *
2026    * This command packs the contents of "directory" and
2027    * downloads it to local file "tarfile".
2028    * 
2029    * To download a compressed tarball, use "g.tgz_out".
2030    * 
2031    * @throws LibGuestFSException
2032    */
2033   public void tar_out (String directory, String tarfile)
2034     throws LibGuestFSException
2035   {
2036     if (g == 0)
2037       throw new LibGuestFSException ("tar_out: handle is closed");
2038     _tar_out (g, directory, tarfile);
2039   }
2040   private native void _tar_out (long g, String directory, String tarfile)
2041     throws LibGuestFSException;
2042
2043   /**
2044    * unpack compressed tarball to directory
2045    *
2046    * This command uploads and unpacks local file "tarball" (a
2047    * *gzip compressed* tar file) into "directory".
2048    * 
2049    * To upload an uncompressed tarball, use "g.tar_in".
2050    * 
2051    * @throws LibGuestFSException
2052    */
2053   public void tgz_in (String tarball, String directory)
2054     throws LibGuestFSException
2055   {
2056     if (g == 0)
2057       throw new LibGuestFSException ("tgz_in: handle is closed");
2058     _tgz_in (g, tarball, directory);
2059   }
2060   private native void _tgz_in (long g, String tarball, String directory)
2061     throws LibGuestFSException;
2062
2063   /**
2064    * pack directory into compressed tarball
2065    *
2066    * This command packs the contents of "directory" and
2067    * downloads it to local file "tarball".
2068    * 
2069    * To download an uncompressed tarball, use "g.tar_out".
2070    * 
2071    * @throws LibGuestFSException
2072    */
2073   public void tgz_out (String directory, String tarball)
2074     throws LibGuestFSException
2075   {
2076     if (g == 0)
2077       throw new LibGuestFSException ("tgz_out: handle is closed");
2078     _tgz_out (g, directory, tarball);
2079   }
2080   private native void _tgz_out (long g, String directory, String tarball)
2081     throws LibGuestFSException;
2082
2083 }