Generated code to support previous 2 commits.
[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 qemu binary
223    *
224    * Set the qemu binary that we will use.
225    * 
226    * The default is chosen when the library was compiled by
227    * the configure script.
228    * 
229    * You can also override this by setting the
230    * "LIBGUESTFS_QEMU" environment variable.
231    * 
232    * The string "qemu" is stashed in the libguestfs handle,
233    * so the caller must make sure it remains valid for the
234    * lifetime of the handle.
235    * 
236    * Setting "qemu" to "NULL" restores the default qemu
237    * binary.
238    * 
239    * @throws LibGuestFSException
240    */
241   public void set_qemu (String qemu)
242     throws LibGuestFSException
243   {
244     if (g == 0)
245       throw new LibGuestFSException ("set_qemu: handle is closed");
246     _set_qemu (g, qemu);
247   }
248   private native void _set_qemu (long g, String qemu)
249     throws LibGuestFSException;
250
251   /**
252    * get the qemu binary
253    *
254    * Return the current qemu binary.
255    * 
256    * This is always non-NULL. If it wasn't set already, then
257    * this will return the default qemu binary name.
258    * 
259    * @throws LibGuestFSException
260    */
261   public String get_qemu ()
262     throws LibGuestFSException
263   {
264     if (g == 0)
265       throw new LibGuestFSException ("get_qemu: handle is closed");
266     return _get_qemu (g);
267   }
268   private native String _get_qemu (long g)
269     throws LibGuestFSException;
270
271   /**
272    * set the search path
273    *
274    * Set the path that libguestfs searches for kernel and
275    * initrd.img.
276    * 
277    * The default is "$libdir/guestfs" unless overridden by
278    * setting "LIBGUESTFS_PATH" environment variable.
279    * 
280    * The string "path" is stashed in the libguestfs handle,
281    * so the caller must make sure it remains valid for the
282    * lifetime of the handle.
283    * 
284    * Setting "path" to "NULL" restores the default path.
285    * 
286    * @throws LibGuestFSException
287    */
288   public void set_path (String path)
289     throws LibGuestFSException
290   {
291     if (g == 0)
292       throw new LibGuestFSException ("set_path: handle is closed");
293     _set_path (g, path);
294   }
295   private native void _set_path (long g, String path)
296     throws LibGuestFSException;
297
298   /**
299    * get the search path
300    *
301    * Return the current search path.
302    * 
303    * This is always non-NULL. If it wasn't set already, then
304    * this will return the default path.
305    * 
306    * @throws LibGuestFSException
307    */
308   public String get_path ()
309     throws LibGuestFSException
310   {
311     if (g == 0)
312       throw new LibGuestFSException ("get_path: handle is closed");
313     return _get_path (g);
314   }
315   private native String _get_path (long g)
316     throws LibGuestFSException;
317
318   /**
319    * set autosync mode
320    *
321    * If "autosync" is true, this enables autosync. Libguestfs
322    * will make a best effort attempt to run "g.umount_all"
323    * followed by "g.sync" when the handle is closed (also if
324    * the program exits without closing handles).
325    * 
326    * This is disabled by default (except in guestfish where
327    * it is enabled by default).
328    * 
329    * @throws LibGuestFSException
330    */
331   public void set_autosync (boolean autosync)
332     throws LibGuestFSException
333   {
334     if (g == 0)
335       throw new LibGuestFSException ("set_autosync: handle is closed");
336     _set_autosync (g, autosync);
337   }
338   private native void _set_autosync (long g, boolean autosync)
339     throws LibGuestFSException;
340
341   /**
342    * get autosync mode
343    *
344    * Get the autosync flag.
345    * 
346    * @throws LibGuestFSException
347    */
348   public boolean get_autosync ()
349     throws LibGuestFSException
350   {
351     if (g == 0)
352       throw new LibGuestFSException ("get_autosync: handle is closed");
353     return _get_autosync (g);
354   }
355   private native boolean _get_autosync (long g)
356     throws LibGuestFSException;
357
358   /**
359    * set verbose mode
360    *
361    * If "verbose" is true, this turns on verbose messages (to
362    * "stderr").
363    * 
364    * Verbose messages are disabled unless the environment
365    * variable "LIBGUESTFS_DEBUG" is defined and set to 1.
366    * 
367    * @throws LibGuestFSException
368    */
369   public void set_verbose (boolean verbose)
370     throws LibGuestFSException
371   {
372     if (g == 0)
373       throw new LibGuestFSException ("set_verbose: handle is closed");
374     _set_verbose (g, verbose);
375   }
376   private native void _set_verbose (long g, boolean verbose)
377     throws LibGuestFSException;
378
379   /**
380    * get verbose mode
381    *
382    * This returns the verbose messages flag.
383    * 
384    * @throws LibGuestFSException
385    */
386   public boolean get_verbose ()
387     throws LibGuestFSException
388   {
389     if (g == 0)
390       throw new LibGuestFSException ("get_verbose: handle is closed");
391     return _get_verbose (g);
392   }
393   private native boolean _get_verbose (long g)
394     throws LibGuestFSException;
395
396   /**
397    * is ready to accept commands
398    *
399    * This returns true iff this handle is ready to accept
400    * commands (in the "READY" state).
401    * 
402    * For more information on states, see guestfs(3).
403    * 
404    * @throws LibGuestFSException
405    */
406   public boolean is_ready ()
407     throws LibGuestFSException
408   {
409     if (g == 0)
410       throw new LibGuestFSException ("is_ready: handle is closed");
411     return _is_ready (g);
412   }
413   private native boolean _is_ready (long g)
414     throws LibGuestFSException;
415
416   /**
417    * is in configuration state
418    *
419    * This returns true iff this handle is being configured
420    * (in the "CONFIG" state).
421    * 
422    * For more information on states, see guestfs(3).
423    * 
424    * @throws LibGuestFSException
425    */
426   public boolean is_config ()
427     throws LibGuestFSException
428   {
429     if (g == 0)
430       throw new LibGuestFSException ("is_config: handle is closed");
431     return _is_config (g);
432   }
433   private native boolean _is_config (long g)
434     throws LibGuestFSException;
435
436   /**
437    * is launching subprocess
438    *
439    * This returns true iff this handle is launching the
440    * subprocess (in the "LAUNCHING" state).
441    * 
442    * For more information on states, see guestfs(3).
443    * 
444    * @throws LibGuestFSException
445    */
446   public boolean is_launching ()
447     throws LibGuestFSException
448   {
449     if (g == 0)
450       throw new LibGuestFSException ("is_launching: handle is closed");
451     return _is_launching (g);
452   }
453   private native boolean _is_launching (long g)
454     throws LibGuestFSException;
455
456   /**
457    * is busy processing a command
458    *
459    * This returns true iff this handle is busy processing a
460    * command (in the "BUSY" state).
461    * 
462    * For more information on states, see guestfs(3).
463    * 
464    * @throws LibGuestFSException
465    */
466   public boolean is_busy ()
467     throws LibGuestFSException
468   {
469     if (g == 0)
470       throw new LibGuestFSException ("is_busy: handle is closed");
471     return _is_busy (g);
472   }
473   private native boolean _is_busy (long g)
474     throws LibGuestFSException;
475
476   /**
477    * get the current state
478    *
479    * This returns the current state as an opaque integer.
480    * This is only useful for printing debug and internal
481    * error messages.
482    * 
483    * For more information on states, see guestfs(3).
484    * 
485    * @throws LibGuestFSException
486    */
487   public int get_state ()
488     throws LibGuestFSException
489   {
490     if (g == 0)
491       throw new LibGuestFSException ("get_state: handle is closed");
492     return _get_state (g);
493   }
494   private native int _get_state (long g)
495     throws LibGuestFSException;
496
497   /**
498    * set state to busy
499    *
500    * This sets the state to "BUSY". This is only used when
501    * implementing actions using the low-level API.
502    * 
503    * For more information on states, see guestfs(3).
504    * 
505    * @throws LibGuestFSException
506    */
507   public void set_busy ()
508     throws LibGuestFSException
509   {
510     if (g == 0)
511       throw new LibGuestFSException ("set_busy: handle is closed");
512     _set_busy (g);
513   }
514   private native void _set_busy (long g)
515     throws LibGuestFSException;
516
517   /**
518    * set state to ready
519    *
520    * This sets the state to "READY". This is only used when
521    * implementing actions using the low-level API.
522    * 
523    * For more information on states, see guestfs(3).
524    * 
525    * @throws LibGuestFSException
526    */
527   public void set_ready ()
528     throws LibGuestFSException
529   {
530     if (g == 0)
531       throw new LibGuestFSException ("set_ready: handle is closed");
532     _set_ready (g);
533   }
534   private native void _set_ready (long g)
535     throws LibGuestFSException;
536
537   /**
538    * mount a guest disk at a position in the filesystem
539    *
540    * Mount a guest disk at a position in the filesystem.
541    * Block devices are named "/dev/sda", "/dev/sdb" and so
542    * on, as they were added to the guest. If those block
543    * devices contain partitions, they will have the usual
544    * names (eg. "/dev/sda1"). Also LVM "/dev/VG/LV"-style
545    * names can be used.
546    * 
547    * The rules are the same as for mount(2): A filesystem
548    * must first be mounted on "/" before others can be
549    * mounted. Other filesystems can only be mounted on
550    * directories which already exist.
551    * 
552    * The mounted filesystem is writable, if we have
553    * sufficient permissions on the underlying device.
554    * 
555    * The filesystem options "sync" and "noatime" are set with
556    * this call, in order to improve reliability.
557    * 
558    * @throws LibGuestFSException
559    */
560   public void mount (String device, String mountpoint)
561     throws LibGuestFSException
562   {
563     if (g == 0)
564       throw new LibGuestFSException ("mount: handle is closed");
565     _mount (g, device, mountpoint);
566   }
567   private native void _mount (long g, String device, String mountpoint)
568     throws LibGuestFSException;
569
570   /**
571    * sync disks, writes are flushed through to the disk image
572    *
573    * This syncs the disk, so that any writes are flushed
574    * through to the underlying disk image.
575    * 
576    * You should always call this if you have modified a disk
577    * image, before closing the handle.
578    * 
579    * @throws LibGuestFSException
580    */
581   public void sync ()
582     throws LibGuestFSException
583   {
584     if (g == 0)
585       throw new LibGuestFSException ("sync: handle is closed");
586     _sync (g);
587   }
588   private native void _sync (long g)
589     throws LibGuestFSException;
590
591   /**
592    * update file timestamps or create a new file
593    *
594    * Touch acts like the touch(1) command. It can be used to
595    * update the timestamps on a file, or, if the file does
596    * not exist, to create a new zero-length file.
597    * 
598    * @throws LibGuestFSException
599    */
600   public void touch (String path)
601     throws LibGuestFSException
602   {
603     if (g == 0)
604       throw new LibGuestFSException ("touch: handle is closed");
605     _touch (g, path);
606   }
607   private native void _touch (long g, String path)
608     throws LibGuestFSException;
609
610   /**
611    * list the contents of a file
612    *
613    * Return the contents of the file named "path".
614    * 
615    * Note that this function cannot correctly handle binary
616    * files (specifically, files containing "\0" character
617    * which is treated as end of string). For those you need
618    * to use the "g.download" function which has a more
619    * complex interface.
620    * 
621    * Because of the message protocol, there is a transfer
622    * limit of somewhere between 2MB and 4MB. To transfer
623    * large files you should use FTP.
624    * 
625    * @throws LibGuestFSException
626    */
627   public String cat (String path)
628     throws LibGuestFSException
629   {
630     if (g == 0)
631       throw new LibGuestFSException ("cat: handle is closed");
632     return _cat (g, path);
633   }
634   private native String _cat (long g, String path)
635     throws LibGuestFSException;
636
637   /**
638    * list the files in a directory (long format)
639    *
640    * List the files in "directory" (relative to the root
641    * directory, there is no cwd) in the format of 'ls -la'.
642    * 
643    * This command is mostly useful for interactive sessions.
644    * It is *not* intended that you try to parse the output
645    * string.
646    * 
647    * @throws LibGuestFSException
648    */
649   public String ll (String directory)
650     throws LibGuestFSException
651   {
652     if (g == 0)
653       throw new LibGuestFSException ("ll: handle is closed");
654     return _ll (g, directory);
655   }
656   private native String _ll (long g, String directory)
657     throws LibGuestFSException;
658
659   /**
660    * list the files in a directory
661    *
662    * List the files in "directory" (relative to the root
663    * directory, there is no cwd). The '.' and '..' entries
664    * are not returned, but hidden files are shown.
665    * 
666    * This command is mostly useful for interactive sessions.
667    * Programs should probably use "g.readdir" instead.
668    * 
669    * @throws LibGuestFSException
670    */
671   public String[] ls (String directory)
672     throws LibGuestFSException
673   {
674     if (g == 0)
675       throw new LibGuestFSException ("ls: handle is closed");
676     return _ls (g, directory);
677   }
678   private native String[] _ls (long g, String directory)
679     throws LibGuestFSException;
680
681   /**
682    * list the block devices
683    *
684    * List all the block devices.
685    * 
686    * The full block device names are returned, eg. "/dev/sda"
687    * 
688    * @throws LibGuestFSException
689    */
690   public String[] list_devices ()
691     throws LibGuestFSException
692   {
693     if (g == 0)
694       throw new LibGuestFSException ("list_devices: handle is closed");
695     return _list_devices (g);
696   }
697   private native String[] _list_devices (long g)
698     throws LibGuestFSException;
699
700   /**
701    * list the partitions
702    *
703    * List all the partitions detected on all block devices.
704    * 
705    * The full partition device names are returned, eg.
706    * "/dev/sda1"
707    * 
708    * This does not return logical volumes. For that you will
709    * need to call "g.lvs".
710    * 
711    * @throws LibGuestFSException
712    */
713   public String[] list_partitions ()
714     throws LibGuestFSException
715   {
716     if (g == 0)
717       throw new LibGuestFSException ("list_partitions: handle is closed");
718     return _list_partitions (g);
719   }
720   private native String[] _list_partitions (long g)
721     throws LibGuestFSException;
722
723   /**
724    * list the LVM physical volumes (PVs)
725    *
726    * List all the physical volumes detected. This is the
727    * equivalent of the pvs(8) command.
728    * 
729    * This returns a list of just the device names that
730    * contain PVs (eg. "/dev/sda2").
731    * 
732    * See also "g.pvs_full".
733    * 
734    * @throws LibGuestFSException
735    */
736   public String[] pvs ()
737     throws LibGuestFSException
738   {
739     if (g == 0)
740       throw new LibGuestFSException ("pvs: handle is closed");
741     return _pvs (g);
742   }
743   private native String[] _pvs (long g)
744     throws LibGuestFSException;
745
746   /**
747    * list the LVM volume groups (VGs)
748    *
749    * List all the volumes groups detected. This is the
750    * equivalent of the vgs(8) command.
751    * 
752    * This returns a list of just the volume group names that
753    * were detected (eg. "VolGroup00").
754    * 
755    * See also "g.vgs_full".
756    * 
757    * @throws LibGuestFSException
758    */
759   public String[] vgs ()
760     throws LibGuestFSException
761   {
762     if (g == 0)
763       throw new LibGuestFSException ("vgs: handle is closed");
764     return _vgs (g);
765   }
766   private native String[] _vgs (long g)
767     throws LibGuestFSException;
768
769   /**
770    * list the LVM logical volumes (LVs)
771    *
772    * List all the logical volumes detected. This is the
773    * equivalent of the lvs(8) command.
774    * 
775    * This returns a list of the logical volume device names
776    * (eg. "/dev/VolGroup00/LogVol00").
777    * 
778    * See also "g.lvs_full".
779    * 
780    * @throws LibGuestFSException
781    */
782   public String[] lvs ()
783     throws LibGuestFSException
784   {
785     if (g == 0)
786       throw new LibGuestFSException ("lvs: handle is closed");
787     return _lvs (g);
788   }
789   private native String[] _lvs (long g)
790     throws LibGuestFSException;
791
792   /**
793    * list the LVM physical volumes (PVs)
794    *
795    * List all the physical volumes detected. This is the
796    * equivalent of the pvs(8) command. The "full" version
797    * includes all fields.
798    * 
799    * @throws LibGuestFSException
800    */
801   public PV[] pvs_full ()
802     throws LibGuestFSException
803   {
804     if (g == 0)
805       throw new LibGuestFSException ("pvs_full: handle is closed");
806     return _pvs_full (g);
807   }
808   private native PV[] _pvs_full (long g)
809     throws LibGuestFSException;
810
811   /**
812    * list the LVM volume groups (VGs)
813    *
814    * List all the volumes groups detected. This is the
815    * equivalent of the vgs(8) command. The "full" version
816    * includes all fields.
817    * 
818    * @throws LibGuestFSException
819    */
820   public VG[] vgs_full ()
821     throws LibGuestFSException
822   {
823     if (g == 0)
824       throw new LibGuestFSException ("vgs_full: handle is closed");
825     return _vgs_full (g);
826   }
827   private native VG[] _vgs_full (long g)
828     throws LibGuestFSException;
829
830   /**
831    * list the LVM logical volumes (LVs)
832    *
833    * List all the logical volumes detected. This is the
834    * equivalent of the lvs(8) command. The "full" version
835    * includes all fields.
836    * 
837    * @throws LibGuestFSException
838    */
839   public LV[] lvs_full ()
840     throws LibGuestFSException
841   {
842     if (g == 0)
843       throw new LibGuestFSException ("lvs_full: handle is closed");
844     return _lvs_full (g);
845   }
846   private native LV[] _lvs_full (long g)
847     throws LibGuestFSException;
848
849   /**
850    * read file as lines
851    *
852    * Return the contents of the file named "path".
853    * 
854    * The file contents are returned as a list of lines.
855    * Trailing "LF" and "CRLF" character sequences are *not*
856    * returned.
857    * 
858    * Note that this function cannot correctly handle binary
859    * files (specifically, files containing "\0" character
860    * which is treated as end of line). For those you need to
861    * use the "g.read_file" function which has a more complex
862    * interface.
863    * 
864    * @throws LibGuestFSException
865    */
866   public String[] read_lines (String path)
867     throws LibGuestFSException
868   {
869     if (g == 0)
870       throw new LibGuestFSException ("read_lines: handle is closed");
871     return _read_lines (g, path);
872   }
873   private native String[] _read_lines (long g, String path)
874     throws LibGuestFSException;
875
876   /**
877    * create a new Augeas handle
878    *
879    * Create a new Augeas handle for editing configuration
880    * files. If there was any previous Augeas handle
881    * associated with this guestfs session, then it is closed.
882    * 
883    * You must call this before using any other "g.aug_*"
884    * commands.
885    * 
886    * "root" is the filesystem root. "root" must not be NULL,
887    * use "/" instead.
888    * 
889    * The flags are the same as the flags defined in
890    * <augeas.h>, the logical *or* of the following integers:
891    * 
892    * "AUG_SAVE_BACKUP" = 1
893    * Keep the original file with a ".augsave" extension.
894    * 
895    * "AUG_SAVE_NEWFILE" = 2
896    * Save changes into a file with extension ".augnew",
897    * and do not overwrite original. Overrides
898    * "AUG_SAVE_BACKUP".
899    * 
900    * "AUG_TYPE_CHECK" = 4
901    * Typecheck lenses (can be expensive).
902    * 
903    * "AUG_NO_STDINC" = 8
904    * Do not use standard load path for modules.
905    * 
906    * "AUG_SAVE_NOOP" = 16
907    * Make save a no-op, just record what would have been
908    * changed.
909    * 
910    * "AUG_NO_LOAD" = 32
911    * Do not load the tree in "g.aug_init".
912    * 
913    * To close the handle, you can call "g.aug_close".
914    * 
915    * To find out more about Augeas, see <http://augeas.net/>.
916    * 
917    * @throws LibGuestFSException
918    */
919   public void aug_init (String root, int flags)
920     throws LibGuestFSException
921   {
922     if (g == 0)
923       throw new LibGuestFSException ("aug_init: handle is closed");
924     _aug_init (g, root, flags);
925   }
926   private native void _aug_init (long g, String root, int flags)
927     throws LibGuestFSException;
928
929   /**
930    * close the current Augeas handle
931    *
932    * Close the current Augeas handle and free up any
933    * resources used by it. After calling this, you have to
934    * call "g.aug_init" again before you can use any other
935    * Augeas functions.
936    * 
937    * @throws LibGuestFSException
938    */
939   public void aug_close ()
940     throws LibGuestFSException
941   {
942     if (g == 0)
943       throw new LibGuestFSException ("aug_close: handle is closed");
944     _aug_close (g);
945   }
946   private native void _aug_close (long g)
947     throws LibGuestFSException;
948
949   /**
950    * define an Augeas variable
951    *
952    * Defines an Augeas variable "name" whose value is the
953    * result of evaluating "expr". If "expr" is NULL, then
954    * "name" is undefined.
955    * 
956    * On success this returns the number of nodes in "expr",
957    * or 0 if "expr" evaluates to something which is not a
958    * nodeset.
959    * 
960    * @throws LibGuestFSException
961    */
962   public int aug_defvar (String name, String expr)
963     throws LibGuestFSException
964   {
965     if (g == 0)
966       throw new LibGuestFSException ("aug_defvar: handle is closed");
967     return _aug_defvar (g, name, expr);
968   }
969   private native int _aug_defvar (long g, String name, String expr)
970     throws LibGuestFSException;
971
972   /**
973    * define an Augeas node
974    *
975    * Defines a variable "name" whose value is the result of
976    * evaluating "expr".
977    * 
978    * If "expr" evaluates to an empty nodeset, a node is
979    * created, equivalent to calling "g.aug_set" "expr",
980    * "value". "name" will be the nodeset containing that
981    * single node.
982    * 
983    * On success this returns a pair containing the number of
984    * nodes in the nodeset, and a boolean flag if a node was
985    * created.
986    * 
987    * @throws LibGuestFSException
988    */
989   public IntBool aug_defnode (String name, String expr, String val)
990     throws LibGuestFSException
991   {
992     if (g == 0)
993       throw new LibGuestFSException ("aug_defnode: handle is closed");
994     return _aug_defnode (g, name, expr, val);
995   }
996   private native IntBool _aug_defnode (long g, String name, String expr, String val)
997     throws LibGuestFSException;
998
999   /**
1000    * look up the value of an Augeas path
1001    *
1002    * Look up the value associated with "path". If "path"
1003    * matches exactly one node, the "value" is returned.
1004    * 
1005    * @throws LibGuestFSException
1006    */
1007   public String aug_get (String path)
1008     throws LibGuestFSException
1009   {
1010     if (g == 0)
1011       throw new LibGuestFSException ("aug_get: handle is closed");
1012     return _aug_get (g, path);
1013   }
1014   private native String _aug_get (long g, String path)
1015     throws LibGuestFSException;
1016
1017   /**
1018    * set Augeas path to value
1019    *
1020    * Set the value associated with "path" to "value".
1021    * 
1022    * @throws LibGuestFSException
1023    */
1024   public void aug_set (String path, String val)
1025     throws LibGuestFSException
1026   {
1027     if (g == 0)
1028       throw new LibGuestFSException ("aug_set: handle is closed");
1029     _aug_set (g, path, val);
1030   }
1031   private native void _aug_set (long g, String path, String val)
1032     throws LibGuestFSException;
1033
1034   /**
1035    * insert a sibling Augeas node
1036    *
1037    * Create a new sibling "label" for "path", inserting it
1038    * into the tree before or after "path" (depending on the
1039    * boolean flag "before").
1040    * 
1041    * "path" must match exactly one existing node in the tree,
1042    * and "label" must be a label, ie. not contain "/", "*" or
1043    * end with a bracketed index "[N]".
1044    * 
1045    * @throws LibGuestFSException
1046    */
1047   public void aug_insert (String path, String label, boolean before)
1048     throws LibGuestFSException
1049   {
1050     if (g == 0)
1051       throw new LibGuestFSException ("aug_insert: handle is closed");
1052     _aug_insert (g, path, label, before);
1053   }
1054   private native void _aug_insert (long g, String path, String label, boolean before)
1055     throws LibGuestFSException;
1056
1057   /**
1058    * remove an Augeas path
1059    *
1060    * Remove "path" and all of its children.
1061    * 
1062    * On success this returns the number of entries which were
1063    * removed.
1064    * 
1065    * @throws LibGuestFSException
1066    */
1067   public int aug_rm (String path)
1068     throws LibGuestFSException
1069   {
1070     if (g == 0)
1071       throw new LibGuestFSException ("aug_rm: handle is closed");
1072     return _aug_rm (g, path);
1073   }
1074   private native int _aug_rm (long g, String path)
1075     throws LibGuestFSException;
1076
1077   /**
1078    * move Augeas node
1079    *
1080    * Move the node "src" to "dest". "src" must match exactly
1081    * one node. "dest" is overwritten if it exists.
1082    * 
1083    * @throws LibGuestFSException
1084    */
1085   public void aug_mv (String src, String dest)
1086     throws LibGuestFSException
1087   {
1088     if (g == 0)
1089       throw new LibGuestFSException ("aug_mv: handle is closed");
1090     _aug_mv (g, src, dest);
1091   }
1092   private native void _aug_mv (long g, String src, String dest)
1093     throws LibGuestFSException;
1094
1095   /**
1096    * return Augeas nodes which match path
1097    *
1098    * Returns a list of paths which match the path expression
1099    * "path". The returned paths are sufficiently qualified so
1100    * that they match exactly one node in the current tree.
1101    * 
1102    * @throws LibGuestFSException
1103    */
1104   public String[] aug_match (String path)
1105     throws LibGuestFSException
1106   {
1107     if (g == 0)
1108       throw new LibGuestFSException ("aug_match: handle is closed");
1109     return _aug_match (g, path);
1110   }
1111   private native String[] _aug_match (long g, String path)
1112     throws LibGuestFSException;
1113
1114   /**
1115    * write all pending Augeas changes to disk
1116    *
1117    * This writes all pending changes to disk.
1118    * 
1119    * The flags which were passed to "g.aug_init" affect
1120    * exactly how files are saved.
1121    * 
1122    * @throws LibGuestFSException
1123    */
1124   public void aug_save ()
1125     throws LibGuestFSException
1126   {
1127     if (g == 0)
1128       throw new LibGuestFSException ("aug_save: handle is closed");
1129     _aug_save (g);
1130   }
1131   private native void _aug_save (long g)
1132     throws LibGuestFSException;
1133
1134   /**
1135    * load files into the tree
1136    *
1137    * Load files into the tree.
1138    * 
1139    * See "aug_load" in the Augeas documentation for the full
1140    * gory details.
1141    * 
1142    * @throws LibGuestFSException
1143    */
1144   public void aug_load ()
1145     throws LibGuestFSException
1146   {
1147     if (g == 0)
1148       throw new LibGuestFSException ("aug_load: handle is closed");
1149     _aug_load (g);
1150   }
1151   private native void _aug_load (long g)
1152     throws LibGuestFSException;
1153
1154   /**
1155    * list Augeas nodes under a path
1156    *
1157    * This is just a shortcut for listing "g.aug_match"
1158    * "path/*" and sorting the resulting nodes into
1159    * alphabetical order.
1160    * 
1161    * @throws LibGuestFSException
1162    */
1163   public String[] aug_ls (String path)
1164     throws LibGuestFSException
1165   {
1166     if (g == 0)
1167       throw new LibGuestFSException ("aug_ls: handle is closed");
1168     return _aug_ls (g, path);
1169   }
1170   private native String[] _aug_ls (long g, String path)
1171     throws LibGuestFSException;
1172
1173   /**
1174    * remove a file
1175    *
1176    * Remove the single file "path".
1177    * 
1178    * @throws LibGuestFSException
1179    */
1180   public void rm (String path)
1181     throws LibGuestFSException
1182   {
1183     if (g == 0)
1184       throw new LibGuestFSException ("rm: handle is closed");
1185     _rm (g, path);
1186   }
1187   private native void _rm (long g, String path)
1188     throws LibGuestFSException;
1189
1190   /**
1191    * remove a directory
1192    *
1193    * Remove the single directory "path".
1194    * 
1195    * @throws LibGuestFSException
1196    */
1197   public void rmdir (String path)
1198     throws LibGuestFSException
1199   {
1200     if (g == 0)
1201       throw new LibGuestFSException ("rmdir: handle is closed");
1202     _rmdir (g, path);
1203   }
1204   private native void _rmdir (long g, String path)
1205     throws LibGuestFSException;
1206
1207   /**
1208    * remove a file or directory recursively
1209    *
1210    * Remove the file or directory "path", recursively
1211    * removing the contents if its a directory. This is like
1212    * the "rm -rf" shell command.
1213    * 
1214    * @throws LibGuestFSException
1215    */
1216   public void rm_rf (String path)
1217     throws LibGuestFSException
1218   {
1219     if (g == 0)
1220       throw new LibGuestFSException ("rm_rf: handle is closed");
1221     _rm_rf (g, path);
1222   }
1223   private native void _rm_rf (long g, String path)
1224     throws LibGuestFSException;
1225
1226   /**
1227    * create a directory
1228    *
1229    * Create a directory named "path".
1230    * 
1231    * @throws LibGuestFSException
1232    */
1233   public void mkdir (String path)
1234     throws LibGuestFSException
1235   {
1236     if (g == 0)
1237       throw new LibGuestFSException ("mkdir: handle is closed");
1238     _mkdir (g, path);
1239   }
1240   private native void _mkdir (long g, String path)
1241     throws LibGuestFSException;
1242
1243   /**
1244    * create a directory and parents
1245    *
1246    * Create a directory named "path", creating any parent
1247    * directories as necessary. This is like the "mkdir -p"
1248    * shell command.
1249    * 
1250    * @throws LibGuestFSException
1251    */
1252   public void mkdir_p (String path)
1253     throws LibGuestFSException
1254   {
1255     if (g == 0)
1256       throw new LibGuestFSException ("mkdir_p: handle is closed");
1257     _mkdir_p (g, path);
1258   }
1259   private native void _mkdir_p (long g, String path)
1260     throws LibGuestFSException;
1261
1262   /**
1263    * change file mode
1264    *
1265    * Change the mode (permissions) of "path" to "mode". Only
1266    * numeric modes are supported.
1267    * 
1268    * @throws LibGuestFSException
1269    */
1270   public void chmod (int mode, String path)
1271     throws LibGuestFSException
1272   {
1273     if (g == 0)
1274       throw new LibGuestFSException ("chmod: handle is closed");
1275     _chmod (g, mode, path);
1276   }
1277   private native void _chmod (long g, int mode, String path)
1278     throws LibGuestFSException;
1279
1280   /**
1281    * change file owner and group
1282    *
1283    * Change the file owner to "owner" and group to "group".
1284    * 
1285    * Only numeric uid and gid are supported. If you want to
1286    * use names, you will need to locate and parse the
1287    * password file yourself (Augeas support makes this
1288    * relatively easy).
1289    * 
1290    * @throws LibGuestFSException
1291    */
1292   public void chown (int owner, int group, String path)
1293     throws LibGuestFSException
1294   {
1295     if (g == 0)
1296       throw new LibGuestFSException ("chown: handle is closed");
1297     _chown (g, owner, group, path);
1298   }
1299   private native void _chown (long g, int owner, int group, String path)
1300     throws LibGuestFSException;
1301
1302   /**
1303    * test if file or directory exists
1304    *
1305    * This returns "true" if and only if there is a file,
1306    * directory (or anything) with the given "path" name.
1307    * 
1308    * See also "g.is_file", "g.is_dir", "g.stat".
1309    * 
1310    * @throws LibGuestFSException
1311    */
1312   public boolean exists (String path)
1313     throws LibGuestFSException
1314   {
1315     if (g == 0)
1316       throw new LibGuestFSException ("exists: handle is closed");
1317     return _exists (g, path);
1318   }
1319   private native boolean _exists (long g, String path)
1320     throws LibGuestFSException;
1321
1322   /**
1323    * test if file exists
1324    *
1325    * This returns "true" if and only if there is a file with
1326    * the given "path" name. Note that it returns false for
1327    * other objects like directories.
1328    * 
1329    * See also "g.stat".
1330    * 
1331    * @throws LibGuestFSException
1332    */
1333   public boolean is_file (String path)
1334     throws LibGuestFSException
1335   {
1336     if (g == 0)
1337       throw new LibGuestFSException ("is_file: handle is closed");
1338     return _is_file (g, path);
1339   }
1340   private native boolean _is_file (long g, String path)
1341     throws LibGuestFSException;
1342
1343   /**
1344    * test if file exists
1345    *
1346    * This returns "true" if and only if there is a directory
1347    * with the given "path" name. Note that it returns false
1348    * for other objects like files.
1349    * 
1350    * See also "g.stat".
1351    * 
1352    * @throws LibGuestFSException
1353    */
1354   public boolean is_dir (String path)
1355     throws LibGuestFSException
1356   {
1357     if (g == 0)
1358       throw new LibGuestFSException ("is_dir: handle is closed");
1359     return _is_dir (g, path);
1360   }
1361   private native boolean _is_dir (long g, String path)
1362     throws LibGuestFSException;
1363
1364   /**
1365    * create an LVM physical volume
1366    *
1367    * This creates an LVM physical volume on the named
1368    * "device", where "device" should usually be a partition
1369    * name such as "/dev/sda1".
1370    * 
1371    * @throws LibGuestFSException
1372    */
1373   public void pvcreate (String device)
1374     throws LibGuestFSException
1375   {
1376     if (g == 0)
1377       throw new LibGuestFSException ("pvcreate: handle is closed");
1378     _pvcreate (g, device);
1379   }
1380   private native void _pvcreate (long g, String device)
1381     throws LibGuestFSException;
1382
1383   /**
1384    * create an LVM volume group
1385    *
1386    * This creates an LVM volume group called "volgroup" from
1387    * the non-empty list of physical volumes "physvols".
1388    * 
1389    * @throws LibGuestFSException
1390    */
1391   public void vgcreate (String volgroup, String[] physvols)
1392     throws LibGuestFSException
1393   {
1394     if (g == 0)
1395       throw new LibGuestFSException ("vgcreate: handle is closed");
1396     _vgcreate (g, volgroup, physvols);
1397   }
1398   private native void _vgcreate (long g, String volgroup, String[] physvols)
1399     throws LibGuestFSException;
1400
1401   /**
1402    * create an LVM volume group
1403    *
1404    * This creates an LVM volume group called "logvol" on the
1405    * volume group "volgroup", with "size" megabytes.
1406    * 
1407    * @throws LibGuestFSException
1408    */
1409   public void lvcreate (String logvol, String volgroup, int mbytes)
1410     throws LibGuestFSException
1411   {
1412     if (g == 0)
1413       throw new LibGuestFSException ("lvcreate: handle is closed");
1414     _lvcreate (g, logvol, volgroup, mbytes);
1415   }
1416   private native void _lvcreate (long g, String logvol, String volgroup, int mbytes)
1417     throws LibGuestFSException;
1418
1419   /**
1420    * make a filesystem
1421    *
1422    * This creates a filesystem on "device" (usually a
1423    * partition or LVM logical volume). The filesystem type is
1424    * "fstype", for example "ext3".
1425    * 
1426    * @throws LibGuestFSException
1427    */
1428   public void mkfs (String fstype, String device)
1429     throws LibGuestFSException
1430   {
1431     if (g == 0)
1432       throw new LibGuestFSException ("mkfs: handle is closed");
1433     _mkfs (g, fstype, device);
1434   }
1435   private native void _mkfs (long g, String fstype, String device)
1436     throws LibGuestFSException;
1437
1438   /**
1439    * create partitions on a block device
1440    *
1441    * This is a direct interface to the sfdisk(8) program for
1442    * creating partitions on block devices.
1443    * 
1444    * "device" should be a block device, for example
1445    * "/dev/sda".
1446    * 
1447    * "cyls", "heads" and "sectors" are the number of
1448    * cylinders, heads and sectors on the device, which are
1449    * passed directly to sfdisk as the *-C*, *-H* and *-S*
1450    * parameters. If you pass 0 for any of these, then the
1451    * corresponding parameter is omitted. Usually for 'large'
1452    * disks, you can just pass 0 for these, but for small
1453    * (floppy-sized) disks, sfdisk (or rather, the kernel)
1454    * cannot work out the right geometry and you will need to
1455    * tell it.
1456    * 
1457    * "lines" is a list of lines that we feed to "sfdisk". For
1458    * more information refer to the sfdisk(8) manpage.
1459    * 
1460    * To create a single partition occupying the whole disk,
1461    * you would pass "lines" as a single element list, when
1462    * the single element being the string "," (comma).
1463    * 
1464    * This command is dangerous. Without careful use you can
1465    * easily destroy all your data.
1466    * 
1467    * @throws LibGuestFSException
1468    */
1469   public void sfdisk (String device, int cyls, int heads, int sectors, String[] lines)
1470     throws LibGuestFSException
1471   {
1472     if (g == 0)
1473       throw new LibGuestFSException ("sfdisk: handle is closed");
1474     _sfdisk (g, device, cyls, heads, sectors, lines);
1475   }
1476   private native void _sfdisk (long g, String device, int cyls, int heads, int sectors, String[] lines)
1477     throws LibGuestFSException;
1478
1479   /**
1480    * create a file
1481    *
1482    * This call creates a file called "path". The contents of
1483    * the file is the string "content" (which can contain any
1484    * 8 bit data), with length "size".
1485    * 
1486    * As a special case, if "size" is 0 then the length is
1487    * calculated using "strlen" (so in this case the content
1488    * cannot contain embedded ASCII NULs).
1489    * 
1490    * *NB.* Owing to a bug, writing content containing ASCII
1491    * NUL characters does *not* work, even if the length is
1492    * specified. We hope to resolve this bug in a future
1493    * version. In the meantime use "g.upload".
1494    * 
1495    * Because of the message protocol, there is a transfer
1496    * limit of somewhere between 2MB and 4MB. To transfer
1497    * large files you should use FTP.
1498    * 
1499    * @throws LibGuestFSException
1500    */
1501   public void write_file (String path, String content, int size)
1502     throws LibGuestFSException
1503   {
1504     if (g == 0)
1505       throw new LibGuestFSException ("write_file: handle is closed");
1506     _write_file (g, path, content, size);
1507   }
1508   private native void _write_file (long g, String path, String content, int size)
1509     throws LibGuestFSException;
1510
1511   /**
1512    * unmount a filesystem
1513    *
1514    * This unmounts the given filesystem. The filesystem may
1515    * be specified either by its mountpoint (path) or the
1516    * device which contains the filesystem.
1517    * 
1518    * @throws LibGuestFSException
1519    */
1520   public void umount (String pathordevice)
1521     throws LibGuestFSException
1522   {
1523     if (g == 0)
1524       throw new LibGuestFSException ("umount: handle is closed");
1525     _umount (g, pathordevice);
1526   }
1527   private native void _umount (long g, String pathordevice)
1528     throws LibGuestFSException;
1529
1530   /**
1531    * show mounted filesystems
1532    *
1533    * This returns the list of currently mounted filesystems.
1534    * It returns the list of devices (eg. "/dev/sda1",
1535    * "/dev/VG/LV").
1536    * 
1537    * Some internal mounts are not shown.
1538    * 
1539    * @throws LibGuestFSException
1540    */
1541   public String[] mounts ()
1542     throws LibGuestFSException
1543   {
1544     if (g == 0)
1545       throw new LibGuestFSException ("mounts: handle is closed");
1546     return _mounts (g);
1547   }
1548   private native String[] _mounts (long g)
1549     throws LibGuestFSException;
1550
1551   /**
1552    * unmount all filesystems
1553    *
1554    * This unmounts all mounted filesystems.
1555    * 
1556    * Some internal mounts are not unmounted by this call.
1557    * 
1558    * @throws LibGuestFSException
1559    */
1560   public void umount_all ()
1561     throws LibGuestFSException
1562   {
1563     if (g == 0)
1564       throw new LibGuestFSException ("umount_all: handle is closed");
1565     _umount_all (g);
1566   }
1567   private native void _umount_all (long g)
1568     throws LibGuestFSException;
1569
1570   /**
1571    * remove all LVM LVs, VGs and PVs
1572    *
1573    * This command removes all LVM logical volumes, volume
1574    * groups and physical volumes.
1575    * 
1576    * This command is dangerous. Without careful use you can
1577    * easily destroy all your data.
1578    * 
1579    * @throws LibGuestFSException
1580    */
1581   public void lvm_remove_all ()
1582     throws LibGuestFSException
1583   {
1584     if (g == 0)
1585       throw new LibGuestFSException ("lvm_remove_all: handle is closed");
1586     _lvm_remove_all (g);
1587   }
1588   private native void _lvm_remove_all (long g)
1589     throws LibGuestFSException;
1590
1591   /**
1592    * determine file type
1593    *
1594    * This call uses the standard file(1) command to determine
1595    * the type or contents of the file. This also works on
1596    * devices, for example to find out whether a partition
1597    * contains a filesystem.
1598    * 
1599    * The exact command which runs is "file -bsL path". Note
1600    * in particular that the filename is not prepended to the
1601    * output (the "-b" option).
1602    * 
1603    * @throws LibGuestFSException
1604    */
1605   public String file (String path)
1606     throws LibGuestFSException
1607   {
1608     if (g == 0)
1609       throw new LibGuestFSException ("file: handle is closed");
1610     return _file (g, path);
1611   }
1612   private native String _file (long g, String path)
1613     throws LibGuestFSException;
1614
1615   /**
1616    * run a command from the guest filesystem
1617    *
1618    * This call runs a command from the guest filesystem. The
1619    * filesystem must be mounted, and must contain a
1620    * compatible operating system (ie. something Linux, with
1621    * the same or compatible processor architecture).
1622    * 
1623    * The single parameter is an argv-style list of arguments.
1624    * The first element is the name of the program to run.
1625    * Subsequent elements are parameters. The list must be
1626    * non-empty (ie. must contain a program name).
1627    * 
1628    * The $PATH environment variable will contain at least
1629    * "/usr/bin" and "/bin". If you require a program from
1630    * another location, you should provide the full path in
1631    * the first parameter.
1632    * 
1633    * Shared libraries and data files required by the program
1634    * must be available on filesystems which are mounted in
1635    * the correct places. It is the caller's responsibility to
1636    * ensure all filesystems that are needed are mounted at
1637    * the right locations.
1638    * 
1639    * @throws LibGuestFSException
1640    */
1641   public String command (String[] arguments)
1642     throws LibGuestFSException
1643   {
1644     if (g == 0)
1645       throw new LibGuestFSException ("command: handle is closed");
1646     return _command (g, arguments);
1647   }
1648   private native String _command (long g, String[] arguments)
1649     throws LibGuestFSException;
1650
1651   /**
1652    * run a command, returning lines
1653    *
1654    * This is the same as "g.command", but splits the result
1655    * into a list of lines.
1656    * 
1657    * @throws LibGuestFSException
1658    */
1659   public String[] command_lines (String[] arguments)
1660     throws LibGuestFSException
1661   {
1662     if (g == 0)
1663       throw new LibGuestFSException ("command_lines: handle is closed");
1664     return _command_lines (g, arguments);
1665   }
1666   private native String[] _command_lines (long g, String[] arguments)
1667     throws LibGuestFSException;
1668
1669   /**
1670    * get file information
1671    *
1672    * Returns file information for the given "path".
1673    * 
1674    * This is the same as the stat(2) system call.
1675    * 
1676    * @throws LibGuestFSException
1677    */
1678   public Stat stat (String path)
1679     throws LibGuestFSException
1680   {
1681     if (g == 0)
1682       throw new LibGuestFSException ("stat: handle is closed");
1683     return _stat (g, path);
1684   }
1685   private native Stat _stat (long g, String path)
1686     throws LibGuestFSException;
1687
1688   /**
1689    * get file information for a symbolic link
1690    *
1691    * Returns file information for the given "path".
1692    * 
1693    * This is the same as "g.stat" except that if "path" is a
1694    * symbolic link, then the link is stat-ed, not the file it
1695    * refers to.
1696    * 
1697    * This is the same as the lstat(2) system call.
1698    * 
1699    * @throws LibGuestFSException
1700    */
1701   public Stat lstat (String path)
1702     throws LibGuestFSException
1703   {
1704     if (g == 0)
1705       throw new LibGuestFSException ("lstat: handle is closed");
1706     return _lstat (g, path);
1707   }
1708   private native Stat _lstat (long g, String path)
1709     throws LibGuestFSException;
1710
1711   /**
1712    * get file system statistics
1713    *
1714    * Returns file system statistics for any mounted file
1715    * system. "path" should be a file or directory in the
1716    * mounted file system (typically it is the mount point
1717    * itself, but it doesn't need to be).
1718    * 
1719    * This is the same as the statvfs(2) system call.
1720    * 
1721    * @throws LibGuestFSException
1722    */
1723   public StatVFS statvfs (String path)
1724     throws LibGuestFSException
1725   {
1726     if (g == 0)
1727       throw new LibGuestFSException ("statvfs: handle is closed");
1728     return _statvfs (g, path);
1729   }
1730   private native StatVFS _statvfs (long g, String path)
1731     throws LibGuestFSException;
1732
1733   /**
1734    * get ext2/ext3/ext4 superblock details
1735    *
1736    * This returns the contents of the ext2, ext3 or ext4
1737    * filesystem superblock on "device".
1738    * 
1739    * It is the same as running "tune2fs -l device". See
1740    * tune2fs(8) manpage for more details. The list of fields
1741    * returned isn't clearly defined, and depends on both the
1742    * version of "tune2fs" that libguestfs was built against,
1743    * and the filesystem itself.
1744    * 
1745    * @throws LibGuestFSException
1746    */
1747   public HashMap<String,String> tune2fs_l (String device)
1748     throws LibGuestFSException
1749   {
1750     if (g == 0)
1751       throw new LibGuestFSException ("tune2fs_l: handle is closed");
1752     return _tune2fs_l (g, device);
1753   }
1754   private native HashMap<String,String> _tune2fs_l (long g, String device)
1755     throws LibGuestFSException;
1756
1757   /**
1758    * set block device to read-only
1759    *
1760    * Sets the block device named "device" to read-only.
1761    * 
1762    * This uses the blockdev(8) command.
1763    * 
1764    * @throws LibGuestFSException
1765    */
1766   public void blockdev_setro (String device)
1767     throws LibGuestFSException
1768   {
1769     if (g == 0)
1770       throw new LibGuestFSException ("blockdev_setro: handle is closed");
1771     _blockdev_setro (g, device);
1772   }
1773   private native void _blockdev_setro (long g, String device)
1774     throws LibGuestFSException;
1775
1776   /**
1777    * set block device to read-write
1778    *
1779    * Sets the block device named "device" to read-write.
1780    * 
1781    * This uses the blockdev(8) command.
1782    * 
1783    * @throws LibGuestFSException
1784    */
1785   public void blockdev_setrw (String device)
1786     throws LibGuestFSException
1787   {
1788     if (g == 0)
1789       throw new LibGuestFSException ("blockdev_setrw: handle is closed");
1790     _blockdev_setrw (g, device);
1791   }
1792   private native void _blockdev_setrw (long g, String device)
1793     throws LibGuestFSException;
1794
1795   /**
1796    * is block device set to read-only
1797    *
1798    * Returns a boolean indicating if the block device is
1799    * read-only (true if read-only, false if not).
1800    * 
1801    * This uses the blockdev(8) command.
1802    * 
1803    * @throws LibGuestFSException
1804    */
1805   public boolean blockdev_getro (String device)
1806     throws LibGuestFSException
1807   {
1808     if (g == 0)
1809       throw new LibGuestFSException ("blockdev_getro: handle is closed");
1810     return _blockdev_getro (g, device);
1811   }
1812   private native boolean _blockdev_getro (long g, String device)
1813     throws LibGuestFSException;
1814
1815   /**
1816    * get sectorsize of block device
1817    *
1818    * This returns the size of sectors on a block device.
1819    * Usually 512, but can be larger for modern devices.
1820    * 
1821    * (Note, this is not the size in sectors, use
1822    * "g.blockdev_getsz" for that).
1823    * 
1824    * This uses the blockdev(8) command.
1825    * 
1826    * @throws LibGuestFSException
1827    */
1828   public int blockdev_getss (String device)
1829     throws LibGuestFSException
1830   {
1831     if (g == 0)
1832       throw new LibGuestFSException ("blockdev_getss: handle is closed");
1833     return _blockdev_getss (g, device);
1834   }
1835   private native int _blockdev_getss (long g, String device)
1836     throws LibGuestFSException;
1837
1838   /**
1839    * get blocksize of block device
1840    *
1841    * This returns the block size of a device.
1842    * 
1843    * (Note this is different from both *size in blocks* and
1844    * *filesystem block size*).
1845    * 
1846    * This uses the blockdev(8) command.
1847    * 
1848    * @throws LibGuestFSException
1849    */
1850   public int blockdev_getbsz (String device)
1851     throws LibGuestFSException
1852   {
1853     if (g == 0)
1854       throw new LibGuestFSException ("blockdev_getbsz: handle is closed");
1855     return _blockdev_getbsz (g, device);
1856   }
1857   private native int _blockdev_getbsz (long g, String device)
1858     throws LibGuestFSException;
1859
1860   /**
1861    * set blocksize of block device
1862    *
1863    * This sets the block size of a device.
1864    * 
1865    * (Note this is different from both *size in blocks* and
1866    * *filesystem block size*).
1867    * 
1868    * This uses the blockdev(8) command.
1869    * 
1870    * @throws LibGuestFSException
1871    */
1872   public void blockdev_setbsz (String device, int blocksize)
1873     throws LibGuestFSException
1874   {
1875     if (g == 0)
1876       throw new LibGuestFSException ("blockdev_setbsz: handle is closed");
1877     _blockdev_setbsz (g, device, blocksize);
1878   }
1879   private native void _blockdev_setbsz (long g, String device, int blocksize)
1880     throws LibGuestFSException;
1881
1882   /**
1883    * get total size of device in 512-byte sectors
1884    *
1885    * This returns the size of the device in units of 512-byte
1886    * sectors (even if the sectorsize isn't 512 bytes ...
1887    * weird).
1888    * 
1889    * See also "g.blockdev_getss" for the real sector size of
1890    * the device, and "g.blockdev_getsize64" for the more
1891    * useful *size in bytes*.
1892    * 
1893    * This uses the blockdev(8) command.
1894    * 
1895    * @throws LibGuestFSException
1896    */
1897   public long blockdev_getsz (String device)
1898     throws LibGuestFSException
1899   {
1900     if (g == 0)
1901       throw new LibGuestFSException ("blockdev_getsz: handle is closed");
1902     return _blockdev_getsz (g, device);
1903   }
1904   private native long _blockdev_getsz (long g, String device)
1905     throws LibGuestFSException;
1906
1907   /**
1908    * get total size of device in bytes
1909    *
1910    * This returns the size of the device in bytes.
1911    * 
1912    * See also "g.blockdev_getsz".
1913    * 
1914    * This uses the blockdev(8) command.
1915    * 
1916    * @throws LibGuestFSException
1917    */
1918   public long blockdev_getsize64 (String device)
1919     throws LibGuestFSException
1920   {
1921     if (g == 0)
1922       throw new LibGuestFSException ("blockdev_getsize64: handle is closed");
1923     return _blockdev_getsize64 (g, device);
1924   }
1925   private native long _blockdev_getsize64 (long g, String device)
1926     throws LibGuestFSException;
1927
1928   /**
1929    * flush device buffers
1930    *
1931    * This tells the kernel to flush internal buffers
1932    * associated with "device".
1933    * 
1934    * This uses the blockdev(8) command.
1935    * 
1936    * @throws LibGuestFSException
1937    */
1938   public void blockdev_flushbufs (String device)
1939     throws LibGuestFSException
1940   {
1941     if (g == 0)
1942       throw new LibGuestFSException ("blockdev_flushbufs: handle is closed");
1943     _blockdev_flushbufs (g, device);
1944   }
1945   private native void _blockdev_flushbufs (long g, String device)
1946     throws LibGuestFSException;
1947
1948   /**
1949    * reread partition table
1950    *
1951    * Reread the partition table on "device".
1952    * 
1953    * This uses the blockdev(8) command.
1954    * 
1955    * @throws LibGuestFSException
1956    */
1957   public void blockdev_rereadpt (String device)
1958     throws LibGuestFSException
1959   {
1960     if (g == 0)
1961       throw new LibGuestFSException ("blockdev_rereadpt: handle is closed");
1962     _blockdev_rereadpt (g, device);
1963   }
1964   private native void _blockdev_rereadpt (long g, String device)
1965     throws LibGuestFSException;
1966
1967   /**
1968    * upload a file from the local machine
1969    *
1970    * Upload local file "filename" to "remotefilename" on the
1971    * filesystem.
1972    * 
1973    * "filename" can also be a named pipe.
1974    * 
1975    * See also "g.download".
1976    * 
1977    * @throws LibGuestFSException
1978    */
1979   public void upload (String filename, String remotefilename)
1980     throws LibGuestFSException
1981   {
1982     if (g == 0)
1983       throw new LibGuestFSException ("upload: handle is closed");
1984     _upload (g, filename, remotefilename);
1985   }
1986   private native void _upload (long g, String filename, String remotefilename)
1987     throws LibGuestFSException;
1988
1989   /**
1990    * download a file to the local machine
1991    *
1992    * Download file "remotefilename" and save it as "filename"
1993    * on the local machine.
1994    * 
1995    * "filename" can also be a named pipe.
1996    * 
1997    * See also "g.upload", "g.cat".
1998    * 
1999    * @throws LibGuestFSException
2000    */
2001   public void download (String remotefilename, String filename)
2002     throws LibGuestFSException
2003   {
2004     if (g == 0)
2005       throw new LibGuestFSException ("download: handle is closed");
2006     _download (g, remotefilename, filename);
2007   }
2008   private native void _download (long g, String remotefilename, String filename)
2009     throws LibGuestFSException;
2010
2011   /**
2012    * compute MD5, SHAx or CRC checksum of file
2013    *
2014    * This call computes the MD5, SHAx or CRC checksum of the
2015    * file named "path".
2016    * 
2017    * The type of checksum to compute is given by the
2018    * "csumtype" parameter which must have one of the
2019    * following values:
2020    * 
2021    * "crc"
2022    * Compute the cyclic redundancy check (CRC) specified
2023    * by POSIX for the "cksum" command.
2024    * 
2025    * "md5"
2026    * Compute the MD5 hash (using the "md5sum" program).
2027    * 
2028    * "sha1"
2029    * Compute the SHA1 hash (using the "sha1sum" program).
2030    * 
2031    * "sha224"
2032    * Compute the SHA224 hash (using the "sha224sum"
2033    * program).
2034    * 
2035    * "sha256"
2036    * Compute the SHA256 hash (using the "sha256sum"
2037    * program).
2038    * 
2039    * "sha384"
2040    * Compute the SHA384 hash (using the "sha384sum"
2041    * program).
2042    * 
2043    * "sha512"
2044    * Compute the SHA512 hash (using the "sha512sum"
2045    * program).
2046    * 
2047    * The checksum is returned as a printable string.
2048    * 
2049    * @throws LibGuestFSException
2050    */
2051   public String checksum (String csumtype, String path)
2052     throws LibGuestFSException
2053   {
2054     if (g == 0)
2055       throw new LibGuestFSException ("checksum: handle is closed");
2056     return _checksum (g, csumtype, path);
2057   }
2058   private native String _checksum (long g, String csumtype, String path)
2059     throws LibGuestFSException;
2060
2061   /**
2062    * unpack tarfile to directory
2063    *
2064    * This command uploads and unpacks local file "tarfile"
2065    * (an *uncompressed* tar file) into "directory".
2066    * 
2067    * To upload a compressed tarball, use "g.tgz_in".
2068    * 
2069    * @throws LibGuestFSException
2070    */
2071   public void tar_in (String tarfile, String directory)
2072     throws LibGuestFSException
2073   {
2074     if (g == 0)
2075       throw new LibGuestFSException ("tar_in: handle is closed");
2076     _tar_in (g, tarfile, directory);
2077   }
2078   private native void _tar_in (long g, String tarfile, String directory)
2079     throws LibGuestFSException;
2080
2081   /**
2082    * pack directory into tarfile
2083    *
2084    * This command packs the contents of "directory" and
2085    * downloads it to local file "tarfile".
2086    * 
2087    * To download a compressed tarball, use "g.tgz_out".
2088    * 
2089    * @throws LibGuestFSException
2090    */
2091   public void tar_out (String directory, String tarfile)
2092     throws LibGuestFSException
2093   {
2094     if (g == 0)
2095       throw new LibGuestFSException ("tar_out: handle is closed");
2096     _tar_out (g, directory, tarfile);
2097   }
2098   private native void _tar_out (long g, String directory, String tarfile)
2099     throws LibGuestFSException;
2100
2101   /**
2102    * unpack compressed tarball to directory
2103    *
2104    * This command uploads and unpacks local file "tarball" (a
2105    * *gzip compressed* tar file) into "directory".
2106    * 
2107    * To upload an uncompressed tarball, use "g.tar_in".
2108    * 
2109    * @throws LibGuestFSException
2110    */
2111   public void tgz_in (String tarball, String directory)
2112     throws LibGuestFSException
2113   {
2114     if (g == 0)
2115       throw new LibGuestFSException ("tgz_in: handle is closed");
2116     _tgz_in (g, tarball, directory);
2117   }
2118   private native void _tgz_in (long g, String tarball, String directory)
2119     throws LibGuestFSException;
2120
2121   /**
2122    * pack directory into compressed tarball
2123    *
2124    * This command packs the contents of "directory" and
2125    * downloads it to local file "tarball".
2126    * 
2127    * To download an uncompressed tarball, use "g.tar_out".
2128    * 
2129    * @throws LibGuestFSException
2130    */
2131   public void tgz_out (String directory, String tarball)
2132     throws LibGuestFSException
2133   {
2134     if (g == 0)
2135       throw new LibGuestFSException ("tgz_out: handle is closed");
2136     _tgz_out (g, directory, tarball);
2137   }
2138   private native void _tgz_out (long g, String directory, String tarball)
2139     throws LibGuestFSException;
2140
2141   /**
2142    * mount a guest disk, read-only
2143    *
2144    * This is the same as the "g.mount" command, but it mounts
2145    * the filesystem with the read-only (*-o ro*) flag.
2146    * 
2147    * @throws LibGuestFSException
2148    */
2149   public void mount_ro (String device, String mountpoint)
2150     throws LibGuestFSException
2151   {
2152     if (g == 0)
2153       throw new LibGuestFSException ("mount_ro: handle is closed");
2154     _mount_ro (g, device, mountpoint);
2155   }
2156   private native void _mount_ro (long g, String device, String mountpoint)
2157     throws LibGuestFSException;
2158
2159   /**
2160    * mount a guest disk with mount options
2161    *
2162    * This is the same as the "g.mount" command, but it allows
2163    * you to set the mount options as for the mount(8) *-o*
2164    * flag.
2165    * 
2166    * @throws LibGuestFSException
2167    */
2168   public void mount_options (String options, String device, String mountpoint)
2169     throws LibGuestFSException
2170   {
2171     if (g == 0)
2172       throw new LibGuestFSException ("mount_options: handle is closed");
2173     _mount_options (g, options, device, mountpoint);
2174   }
2175   private native void _mount_options (long g, String options, String device, String mountpoint)
2176     throws LibGuestFSException;
2177
2178   /**
2179    * mount a guest disk with mount options and vfstype
2180    *
2181    * This is the same as the "g.mount" command, but it allows
2182    * you to set both the mount options and the vfstype as for
2183    * the mount(8) *-o* and *-t* flags.
2184    * 
2185    * @throws LibGuestFSException
2186    */
2187   public void mount_vfs (String options, String vfstype, String device, String mountpoint)
2188     throws LibGuestFSException
2189   {
2190     if (g == 0)
2191       throw new LibGuestFSException ("mount_vfs: handle is closed");
2192     _mount_vfs (g, options, vfstype, device, mountpoint);
2193   }
2194   private native void _mount_vfs (long g, String options, String vfstype, String device, String mountpoint)
2195     throws LibGuestFSException;
2196
2197   /**
2198    * debugging and internals
2199    *
2200    * The "g.debug" command exposes some internals of
2201    * "guestfsd" (the guestfs daemon) that runs inside the
2202    * qemu subprocess.
2203    * 
2204    * There is no comprehensive help for this command. You
2205    * have to look at the file "daemon/debug.c" in the
2206    * libguestfs source to find out what you can do.
2207    * 
2208    * @throws LibGuestFSException
2209    */
2210   public String debug (String subcmd, String[] extraargs)
2211     throws LibGuestFSException
2212   {
2213     if (g == 0)
2214       throw new LibGuestFSException ("debug: handle is closed");
2215     return _debug (g, subcmd, extraargs);
2216   }
2217   private native String _debug (long g, String subcmd, String[] extraargs)
2218     throws LibGuestFSException;
2219
2220   /**
2221    * remove an LVM logical volume
2222    *
2223    * Remove an LVM logical volume "device", where "device" is
2224    * the path to the LV, such as "/dev/VG/LV".
2225    * 
2226    * You can also remove all LVs in a volume group by
2227    * specifying the VG name, "/dev/VG".
2228    * 
2229    * @throws LibGuestFSException
2230    */
2231   public void lvremove (String device)
2232     throws LibGuestFSException
2233   {
2234     if (g == 0)
2235       throw new LibGuestFSException ("lvremove: handle is closed");
2236     _lvremove (g, device);
2237   }
2238   private native void _lvremove (long g, String device)
2239     throws LibGuestFSException;
2240
2241   /**
2242    * remove an LVM volume group
2243    *
2244    * Remove an LVM volume group "vgname", (for example "VG").
2245    * 
2246    * This also forcibly removes all logical volumes in the
2247    * volume group (if any).
2248    * 
2249    * @throws LibGuestFSException
2250    */
2251   public void vgremove (String vgname)
2252     throws LibGuestFSException
2253   {
2254     if (g == 0)
2255       throw new LibGuestFSException ("vgremove: handle is closed");
2256     _vgremove (g, vgname);
2257   }
2258   private native void _vgremove (long g, String vgname)
2259     throws LibGuestFSException;
2260
2261   /**
2262    * remove an LVM physical volume
2263    *
2264    * This wipes a physical volume "device" so that LVM will
2265    * no longer recognise it.
2266    * 
2267    * The implementation uses the "pvremove" command which
2268    * refuses to wipe physical volumes that contain any volume
2269    * groups, so you have to remove those first.
2270    * 
2271    * @throws LibGuestFSException
2272    */
2273   public void pvremove (String device)
2274     throws LibGuestFSException
2275   {
2276     if (g == 0)
2277       throw new LibGuestFSException ("pvremove: handle is closed");
2278     _pvremove (g, device);
2279   }
2280   private native void _pvremove (long g, String device)
2281     throws LibGuestFSException;
2282
2283   /**
2284    * set the ext2/3/4 filesystem label
2285    *
2286    * This sets the ext2/3/4 filesystem label of the
2287    * filesystem on "device" to "label". Filesystem labels are
2288    * limited to 16 characters.
2289    * 
2290    * You can use either "g.tune2fs_l" or "g.get_e2label" to
2291    * return the existing label on a filesystem.
2292    * 
2293    * @throws LibGuestFSException
2294    */
2295   public void set_e2label (String device, String label)
2296     throws LibGuestFSException
2297   {
2298     if (g == 0)
2299       throw new LibGuestFSException ("set_e2label: handle is closed");
2300     _set_e2label (g, device, label);
2301   }
2302   private native void _set_e2label (long g, String device, String label)
2303     throws LibGuestFSException;
2304
2305   /**
2306    * get the ext2/3/4 filesystem label
2307    *
2308    * This returns the ext2/3/4 filesystem label of the
2309    * filesystem on "device".
2310    * 
2311    * @throws LibGuestFSException
2312    */
2313   public String get_e2label (String device)
2314     throws LibGuestFSException
2315   {
2316     if (g == 0)
2317       throw new LibGuestFSException ("get_e2label: handle is closed");
2318     return _get_e2label (g, device);
2319   }
2320   private native String _get_e2label (long g, String device)
2321     throws LibGuestFSException;
2322
2323   /**
2324    * set the ext2/3/4 filesystem UUID
2325    *
2326    * This sets the ext2/3/4 filesystem UUID of the filesystem
2327    * on "device" to "uuid". The format of the UUID and
2328    * alternatives such as "clear", "random" and "time" are
2329    * described in the tune2fs(8) manpage.
2330    * 
2331    * You can use either "g.tune2fs_l" or "g.get_e2uuid" to
2332    * return the existing UUID of a filesystem.
2333    * 
2334    * @throws LibGuestFSException
2335    */
2336   public void set_e2uuid (String device, String uuid)
2337     throws LibGuestFSException
2338   {
2339     if (g == 0)
2340       throw new LibGuestFSException ("set_e2uuid: handle is closed");
2341     _set_e2uuid (g, device, uuid);
2342   }
2343   private native void _set_e2uuid (long g, String device, String uuid)
2344     throws LibGuestFSException;
2345
2346   /**
2347    * get the ext2/3/4 filesystem UUID
2348    *
2349    * This returns the ext2/3/4 filesystem UUID of the
2350    * filesystem on "device".
2351    * 
2352    * @throws LibGuestFSException
2353    */
2354   public String get_e2uuid (String device)
2355     throws LibGuestFSException
2356   {
2357     if (g == 0)
2358       throw new LibGuestFSException ("get_e2uuid: handle is closed");
2359     return _get_e2uuid (g, device);
2360   }
2361   private native String _get_e2uuid (long g, String device)
2362     throws LibGuestFSException;
2363
2364   /**
2365    * run the filesystem checker
2366    *
2367    * This runs the filesystem checker (fsck) on "device"
2368    * which should have filesystem type "fstype".
2369    * 
2370    * The returned integer is the status. See fsck(8) for the
2371    * list of status codes from "fsck".
2372    * 
2373    * Notes:
2374    * 
2375    * *   Multiple status codes can be summed together.
2376    * 
2377    * *   A non-zero return code can mean "success", for
2378    * example if errors have been corrected on the
2379    * filesystem.
2380    * 
2381    * *   Checking or repairing NTFS volumes is not supported
2382    * (by linux-ntfs).
2383    * 
2384    * This command is entirely equivalent to running "fsck -a
2385    * -t fstype device".
2386    * 
2387    * @throws LibGuestFSException
2388    */
2389   public int fsck (String fstype, String device)
2390     throws LibGuestFSException
2391   {
2392     if (g == 0)
2393       throw new LibGuestFSException ("fsck: handle is closed");
2394     return _fsck (g, fstype, device);
2395   }
2396   private native int _fsck (long g, String fstype, String device)
2397     throws LibGuestFSException;
2398
2399   /**
2400    * write zeroes to the device
2401    *
2402    * This command writes zeroes over the first few blocks of
2403    * "device".
2404    * 
2405    * How many blocks are zeroed isn't specified (but it's
2406    * *not* enough to securely wipe the device). It should be
2407    * sufficient to remove any partition tables, filesystem
2408    * superblocks and so on.
2409    * 
2410    * @throws LibGuestFSException
2411    */
2412   public void zero (String device)
2413     throws LibGuestFSException
2414   {
2415     if (g == 0)
2416       throw new LibGuestFSException ("zero: handle is closed");
2417     _zero (g, device);
2418   }
2419   private native void _zero (long g, String device)
2420     throws LibGuestFSException;
2421
2422   /**
2423    * install GRUB
2424    *
2425    * This command installs GRUB (the Grand Unified
2426    * Bootloader) on "device", with the root directory being
2427    * "root".
2428    * 
2429    * @throws LibGuestFSException
2430    */
2431   public void grub_install (String root, String device)
2432     throws LibGuestFSException
2433   {
2434     if (g == 0)
2435       throw new LibGuestFSException ("grub_install: handle is closed");
2436     _grub_install (g, root, device);
2437   }
2438   private native void _grub_install (long g, String root, String device)
2439     throws LibGuestFSException;
2440
2441   /**
2442    * copy a file
2443    *
2444    * This copies a file from "src" to "dest" where "dest" is
2445    * either a destination filename or destination directory.
2446    * 
2447    * @throws LibGuestFSException
2448    */
2449   public void cp (String src, String dest)
2450     throws LibGuestFSException
2451   {
2452     if (g == 0)
2453       throw new LibGuestFSException ("cp: handle is closed");
2454     _cp (g, src, dest);
2455   }
2456   private native void _cp (long g, String src, String dest)
2457     throws LibGuestFSException;
2458
2459   /**
2460    * copy a file or directory recursively
2461    *
2462    * This copies a file or directory from "src" to "dest"
2463    * recursively using the "cp -a" command.
2464    * 
2465    * @throws LibGuestFSException
2466    */
2467   public void cp_a (String src, String dest)
2468     throws LibGuestFSException
2469   {
2470     if (g == 0)
2471       throw new LibGuestFSException ("cp_a: handle is closed");
2472     _cp_a (g, src, dest);
2473   }
2474   private native void _cp_a (long g, String src, String dest)
2475     throws LibGuestFSException;
2476
2477   /**
2478    * move a file
2479    *
2480    * This moves a file from "src" to "dest" where "dest" is
2481    * either a destination filename or destination directory.
2482    * 
2483    * @throws LibGuestFSException
2484    */
2485   public void mv (String src, String dest)
2486     throws LibGuestFSException
2487   {
2488     if (g == 0)
2489       throw new LibGuestFSException ("mv: handle is closed");
2490     _mv (g, src, dest);
2491   }
2492   private native void _mv (long g, String src, String dest)
2493     throws LibGuestFSException;
2494
2495   /**
2496    * drop kernel page cache, dentries and inodes
2497    *
2498    * This instructs the guest kernel to drop its page cache,
2499    * and/or dentries and inode caches. The parameter
2500    * "whattodrop" tells the kernel what precisely to drop,
2501    * see <http://linux-mm.org/Drop_Caches>
2502    * 
2503    * Setting "whattodrop" to 3 should drop everything.
2504    * 
2505    * This automatically calls sync(2) before the operation,
2506    * so that the maximum guest memory is freed.
2507    * 
2508    * @throws LibGuestFSException
2509    */
2510   public void drop_caches (int whattodrop)
2511     throws LibGuestFSException
2512   {
2513     if (g == 0)
2514       throw new LibGuestFSException ("drop_caches: handle is closed");
2515     _drop_caches (g, whattodrop);
2516   }
2517   private native void _drop_caches (long g, int whattodrop)
2518     throws LibGuestFSException;
2519
2520   /**
2521    * return kernel messages
2522    *
2523    * This returns the kernel messages ("dmesg" output) from
2524    * the guest kernel. This is sometimes useful for extended
2525    * debugging of problems.
2526    * 
2527    * Another way to get the same information is to enable
2528    * verbose messages with "g.set_verbose" or by setting the
2529    * environment variable "LIBGUESTFS_DEBUG=1" before running
2530    * the program.
2531    * 
2532    * @throws LibGuestFSException
2533    */
2534   public String dmesg ()
2535     throws LibGuestFSException
2536   {
2537     if (g == 0)
2538       throw new LibGuestFSException ("dmesg: handle is closed");
2539     return _dmesg (g);
2540   }
2541   private native String _dmesg (long g)
2542     throws LibGuestFSException;
2543
2544   /**
2545    * ping the guest daemon
2546    *
2547    * This is a test probe into the guestfs daemon running
2548    * inside the qemu subprocess. Calling this function checks
2549    * that the daemon responds to the ping message, without
2550    * affecting the daemon or attached block device(s) in any
2551    * other way.
2552    * 
2553    * @throws LibGuestFSException
2554    */
2555   public void ping_daemon ()
2556     throws LibGuestFSException
2557   {
2558     if (g == 0)
2559       throw new LibGuestFSException ("ping_daemon: handle is closed");
2560     _ping_daemon (g);
2561   }
2562   private native void _ping_daemon (long g)
2563     throws LibGuestFSException;
2564
2565   /**
2566    * test if two files have equal contents
2567    *
2568    * This compares the two files "file1" and "file2" and
2569    * returns true if their content is exactly equal, or false
2570    * otherwise.
2571    * 
2572    * The external cmp(1) program is used for the comparison.
2573    * 
2574    * @throws LibGuestFSException
2575    */
2576   public boolean equal (String file1, String file2)
2577     throws LibGuestFSException
2578   {
2579     if (g == 0)
2580       throw new LibGuestFSException ("equal: handle is closed");
2581     return _equal (g, file1, file2);
2582   }
2583   private native boolean _equal (long g, String file1, String file2)
2584     throws LibGuestFSException;
2585
2586   /**
2587    * print the printable strings in a file
2588    *
2589    * This runs the strings(1) command on a file and returns
2590    * the list of printable strings found.
2591    * 
2592    * Because of the message protocol, there is a transfer
2593    * limit of somewhere between 2MB and 4MB. To transfer
2594    * large files you should use FTP.
2595    * 
2596    * @throws LibGuestFSException
2597    */
2598   public String[] strings (String path)
2599     throws LibGuestFSException
2600   {
2601     if (g == 0)
2602       throw new LibGuestFSException ("strings: handle is closed");
2603     return _strings (g, path);
2604   }
2605   private native String[] _strings (long g, String path)
2606     throws LibGuestFSException;
2607
2608   /**
2609    * print the printable strings in a file
2610    *
2611    * This is like the "g.strings" command, but allows you to
2612    * specify the encoding.
2613    * 
2614    * See the strings(1) manpage for the full list of
2615    * encodings.
2616    * 
2617    * Commonly useful encodings are "l" (lower case L) which
2618    * will show strings inside Windows/x86 files.
2619    * 
2620    * The returned strings are transcoded to UTF-8.
2621    * 
2622    * Because of the message protocol, there is a transfer
2623    * limit of somewhere between 2MB and 4MB. To transfer
2624    * large files you should use FTP.
2625    * 
2626    * @throws LibGuestFSException
2627    */
2628   public String[] strings_e (String encoding, String path)
2629     throws LibGuestFSException
2630   {
2631     if (g == 0)
2632       throw new LibGuestFSException ("strings_e: handle is closed");
2633     return _strings_e (g, encoding, path);
2634   }
2635   private native String[] _strings_e (long g, String encoding, String path)
2636     throws LibGuestFSException;
2637
2638   /**
2639    * dump a file in hexadecimal
2640    *
2641    * This runs "hexdump -C" on the given "path". The result
2642    * is the human-readable, canonical hex dump of the file.
2643    * 
2644    * Because of the message protocol, there is a transfer
2645    * limit of somewhere between 2MB and 4MB. To transfer
2646    * large files you should use FTP.
2647    * 
2648    * @throws LibGuestFSException
2649    */
2650   public String hexdump (String path)
2651     throws LibGuestFSException
2652   {
2653     if (g == 0)
2654       throw new LibGuestFSException ("hexdump: handle is closed");
2655     return _hexdump (g, path);
2656   }
2657   private native String _hexdump (long g, String path)
2658     throws LibGuestFSException;
2659
2660 }