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.
5 * Copyright (C) 2009 Red Hat Inc.
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.
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.
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
22 package com.redhat.et.libguestfs;
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;
34 * The GuestFS object is a libguestfs handle.
38 public class GuestFS {
39 // Load the native code.
41 System.loadLibrary ("guestfs_jni");
45 * The native guestfs_h pointer.
50 * Create a libguestfs handle.
52 * @throws LibGuestFSException
54 public GuestFS () throws LibGuestFSException
58 private native long _create () throws LibGuestFSException;
61 * Close a libguestfs handle.
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
69 * @throws LibGuestFSException
71 public void close () throws LibGuestFSException
77 private native void _close (long g) throws LibGuestFSException;
79 public void finalize () throws LibGuestFSException
85 * launch the qemu subprocess
87 * Internally libguestfs is implemented by running a
88 * virtual machine using qemu(1).
90 * You should call this after configuring the handle (eg.
91 * adding drives) but before performing any actions.
93 * @throws LibGuestFSException
96 throws LibGuestFSException
99 throw new LibGuestFSException ("launch: handle is closed");
102 private native void _launch (long g)
103 throws LibGuestFSException;
106 * wait until the qemu subprocess launches
108 * Internally libguestfs is implemented by running a
109 * virtual machine using qemu(1).
111 * You should call this after "g.launch" to wait for the
112 * launch to complete.
114 * @throws LibGuestFSException
116 public void wait_ready ()
117 throws LibGuestFSException
120 throw new LibGuestFSException ("wait_ready: handle is closed");
123 private native void _wait_ready (long g)
124 throws LibGuestFSException;
127 * kill the qemu subprocess
129 * This kills the qemu subprocess. You should never need to
132 * @throws LibGuestFSException
134 public void kill_subprocess ()
135 throws LibGuestFSException
138 throw new LibGuestFSException ("kill_subprocess: handle is closed");
139 _kill_subprocess (g);
141 private native void _kill_subprocess (long g)
142 throws LibGuestFSException;
145 * add an image to examine or modify
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.
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).
159 * This is equivalent to the qemu parameter "-drive
162 * @throws LibGuestFSException
164 public void add_drive (String filename)
165 throws LibGuestFSException
168 throw new LibGuestFSException ("add_drive: handle is closed");
169 _add_drive (g, filename);
171 private native void _add_drive (long g, String filename)
172 throws LibGuestFSException;
175 * add a CD-ROM disk image to examine
177 * This function adds a virtual CD-ROM disk image to the
180 * This is equivalent to the qemu parameter "-cdrom
183 * @throws LibGuestFSException
185 public void add_cdrom (String filename)
186 throws LibGuestFSException
189 throw new LibGuestFSException ("add_cdrom: handle is closed");
190 _add_cdrom (g, filename);
192 private native void _add_cdrom (long g, String filename)
193 throws LibGuestFSException;
196 * add qemu parameters
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
204 * The first character of "param" string must be a "-"
207 * "value" can be NULL.
209 * @throws LibGuestFSException
211 public void config (String qemuparam, String qemuvalue)
212 throws LibGuestFSException
215 throw new LibGuestFSException ("config: handle is closed");
216 _config (g, qemuparam, qemuvalue);
218 private native void _config (long g, String qemuparam, String qemuvalue)
219 throws LibGuestFSException;
222 * set the qemu binary
224 * Set the qemu binary that we will use.
226 * The default is chosen when the library was compiled by
227 * the configure script.
229 * You can also override this by setting the
230 * "LIBGUESTFS_QEMU" environment variable.
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.
236 * Setting "qemu" to "NULL" restores the default qemu
239 * @throws LibGuestFSException
241 public void set_qemu (String qemu)
242 throws LibGuestFSException
245 throw new LibGuestFSException ("set_qemu: handle is closed");
248 private native void _set_qemu (long g, String qemu)
249 throws LibGuestFSException;
252 * get the qemu binary
254 * Return the current qemu binary.
256 * This is always non-NULL. If it wasn't set already, then
257 * this will return the default qemu binary name.
259 * @throws LibGuestFSException
261 public String get_qemu ()
262 throws LibGuestFSException
265 throw new LibGuestFSException ("get_qemu: handle is closed");
266 return _get_qemu (g);
268 private native String _get_qemu (long g)
269 throws LibGuestFSException;
272 * set the search path
274 * Set the path that libguestfs searches for kernel and
277 * The default is "$libdir/guestfs" unless overridden by
278 * setting "LIBGUESTFS_PATH" environment variable.
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.
284 * Setting "path" to "NULL" restores the default path.
286 * @throws LibGuestFSException
288 public void set_path (String path)
289 throws LibGuestFSException
292 throw new LibGuestFSException ("set_path: handle is closed");
295 private native void _set_path (long g, String path)
296 throws LibGuestFSException;
299 * get the search path
301 * Return the current search path.
303 * This is always non-NULL. If it wasn't set already, then
304 * this will return the default path.
306 * @throws LibGuestFSException
308 public String get_path ()
309 throws LibGuestFSException
312 throw new LibGuestFSException ("get_path: handle is closed");
313 return _get_path (g);
315 private native String _get_path (long g)
316 throws LibGuestFSException;
321 * If "autosync" is true, this enables autosync. Libguestfs
322 * will make a best effort attempt to run "g.sync" when the
323 * handle is closed (also if the program exits without
326 * @throws LibGuestFSException
328 public void set_autosync (boolean autosync)
329 throws LibGuestFSException
332 throw new LibGuestFSException ("set_autosync: handle is closed");
333 _set_autosync (g, autosync);
335 private native void _set_autosync (long g, boolean autosync)
336 throws LibGuestFSException;
341 * Get the autosync flag.
343 * @throws LibGuestFSException
345 public boolean get_autosync ()
346 throws LibGuestFSException
349 throw new LibGuestFSException ("get_autosync: handle is closed");
350 return _get_autosync (g);
352 private native boolean _get_autosync (long g)
353 throws LibGuestFSException;
358 * If "verbose" is true, this turns on verbose messages (to
361 * Verbose messages are disabled unless the environment
362 * variable "LIBGUESTFS_DEBUG" is defined and set to 1.
364 * @throws LibGuestFSException
366 public void set_verbose (boolean verbose)
367 throws LibGuestFSException
370 throw new LibGuestFSException ("set_verbose: handle is closed");
371 _set_verbose (g, verbose);
373 private native void _set_verbose (long g, boolean verbose)
374 throws LibGuestFSException;
379 * This returns the verbose messages flag.
381 * @throws LibGuestFSException
383 public boolean get_verbose ()
384 throws LibGuestFSException
387 throw new LibGuestFSException ("get_verbose: handle is closed");
388 return _get_verbose (g);
390 private native boolean _get_verbose (long g)
391 throws LibGuestFSException;
394 * is ready to accept commands
396 * This returns true iff this handle is ready to accept
397 * commands (in the "READY" state).
399 * For more information on states, see guestfs(3).
401 * @throws LibGuestFSException
403 public boolean is_ready ()
404 throws LibGuestFSException
407 throw new LibGuestFSException ("is_ready: handle is closed");
408 return _is_ready (g);
410 private native boolean _is_ready (long g)
411 throws LibGuestFSException;
414 * is in configuration state
416 * This returns true iff this handle is being configured
417 * (in the "CONFIG" state).
419 * For more information on states, see guestfs(3).
421 * @throws LibGuestFSException
423 public boolean is_config ()
424 throws LibGuestFSException
427 throw new LibGuestFSException ("is_config: handle is closed");
428 return _is_config (g);
430 private native boolean _is_config (long g)
431 throws LibGuestFSException;
434 * is launching subprocess
436 * This returns true iff this handle is launching the
437 * subprocess (in the "LAUNCHING" state).
439 * For more information on states, see guestfs(3).
441 * @throws LibGuestFSException
443 public boolean is_launching ()
444 throws LibGuestFSException
447 throw new LibGuestFSException ("is_launching: handle is closed");
448 return _is_launching (g);
450 private native boolean _is_launching (long g)
451 throws LibGuestFSException;
454 * is busy processing a command
456 * This returns true iff this handle is busy processing a
457 * command (in the "BUSY" state).
459 * For more information on states, see guestfs(3).
461 * @throws LibGuestFSException
463 public boolean is_busy ()
464 throws LibGuestFSException
467 throw new LibGuestFSException ("is_busy: handle is closed");
470 private native boolean _is_busy (long g)
471 throws LibGuestFSException;
474 * get the current state
476 * This returns the current state as an opaque integer.
477 * This is only useful for printing debug and internal
480 * For more information on states, see guestfs(3).
482 * @throws LibGuestFSException
484 public int get_state ()
485 throws LibGuestFSException
488 throw new LibGuestFSException ("get_state: handle is closed");
489 return _get_state (g);
491 private native int _get_state (long g)
492 throws LibGuestFSException;
497 * This sets the state to "BUSY". This is only used when
498 * implementing actions using the low-level API.
500 * For more information on states, see guestfs(3).
502 * @throws LibGuestFSException
504 public void set_busy ()
505 throws LibGuestFSException
508 throw new LibGuestFSException ("set_busy: handle is closed");
511 private native void _set_busy (long g)
512 throws LibGuestFSException;
517 * This sets the state to "READY". This is only used when
518 * implementing actions using the low-level API.
520 * For more information on states, see guestfs(3).
522 * @throws LibGuestFSException
524 public void set_ready ()
525 throws LibGuestFSException
528 throw new LibGuestFSException ("set_ready: handle is closed");
531 private native void _set_ready (long g)
532 throws LibGuestFSException;
535 * mount a guest disk at a position in the filesystem
537 * Mount a guest disk at a position in the filesystem.
538 * Block devices are named "/dev/sda", "/dev/sdb" and so
539 * on, as they were added to the guest. If those block
540 * devices contain partitions, they will have the usual
541 * names (eg. "/dev/sda1"). Also LVM "/dev/VG/LV"-style
544 * The rules are the same as for mount(2): A filesystem
545 * must first be mounted on "/" before others can be
546 * mounted. Other filesystems can only be mounted on
547 * directories which already exist.
549 * The mounted filesystem is writable, if we have
550 * sufficient permissions on the underlying device.
552 * The filesystem options "sync" and "noatime" are set with
553 * this call, in order to improve reliability.
555 * @throws LibGuestFSException
557 public void mount (String device, String mountpoint)
558 throws LibGuestFSException
561 throw new LibGuestFSException ("mount: handle is closed");
562 _mount (g, device, mountpoint);
564 private native void _mount (long g, String device, String mountpoint)
565 throws LibGuestFSException;
568 * sync disks, writes are flushed through to the disk image
570 * This syncs the disk, so that any writes are flushed
571 * through to the underlying disk image.
573 * You should always call this if you have modified a disk
574 * image, before closing the handle.
576 * @throws LibGuestFSException
579 throws LibGuestFSException
582 throw new LibGuestFSException ("sync: handle is closed");
585 private native void _sync (long g)
586 throws LibGuestFSException;
589 * update file timestamps or create a new file
591 * Touch acts like the touch(1) command. It can be used to
592 * update the timestamps on a file, or, if the file does
593 * not exist, to create a new zero-length file.
595 * @throws LibGuestFSException
597 public void touch (String path)
598 throws LibGuestFSException
601 throw new LibGuestFSException ("touch: handle is closed");
604 private native void _touch (long g, String path)
605 throws LibGuestFSException;
608 * list the contents of a file
610 * Return the contents of the file named "path".
612 * Note that this function cannot correctly handle binary
613 * files (specifically, files containing "\0" character
614 * which is treated as end of string). For those you need
615 * to use the "g.download" function which has a more
618 * Because of the message protocol, there is a transfer
619 * limit of somewhere between 2MB and 4MB. To transfer
620 * large files you should use FTP.
622 * @throws LibGuestFSException
624 public String cat (String path)
625 throws LibGuestFSException
628 throw new LibGuestFSException ("cat: handle is closed");
629 return _cat (g, path);
631 private native String _cat (long g, String path)
632 throws LibGuestFSException;
635 * list the files in a directory (long format)
637 * List the files in "directory" (relative to the root
638 * directory, there is no cwd) in the format of 'ls -la'.
640 * This command is mostly useful for interactive sessions.
641 * It is *not* intended that you try to parse the output
644 * @throws LibGuestFSException
646 public String ll (String directory)
647 throws LibGuestFSException
650 throw new LibGuestFSException ("ll: handle is closed");
651 return _ll (g, directory);
653 private native String _ll (long g, String directory)
654 throws LibGuestFSException;
657 * list the files in a directory
659 * List the files in "directory" (relative to the root
660 * directory, there is no cwd). The '.' and '..' entries
661 * are not returned, but hidden files are shown.
663 * This command is mostly useful for interactive sessions.
664 * Programs should probably use "g.readdir" instead.
666 * @throws LibGuestFSException
668 public String[] ls (String directory)
669 throws LibGuestFSException
672 throw new LibGuestFSException ("ls: handle is closed");
673 return _ls (g, directory);
675 private native String[] _ls (long g, String directory)
676 throws LibGuestFSException;
679 * list the block devices
681 * List all the block devices.
683 * The full block device names are returned, eg. "/dev/sda"
685 * @throws LibGuestFSException
687 public String[] list_devices ()
688 throws LibGuestFSException
691 throw new LibGuestFSException ("list_devices: handle is closed");
692 return _list_devices (g);
694 private native String[] _list_devices (long g)
695 throws LibGuestFSException;
698 * list the partitions
700 * List all the partitions detected on all block devices.
702 * The full partition device names are returned, eg.
705 * This does not return logical volumes. For that you will
706 * need to call "g.lvs".
708 * @throws LibGuestFSException
710 public String[] list_partitions ()
711 throws LibGuestFSException
714 throw new LibGuestFSException ("list_partitions: handle is closed");
715 return _list_partitions (g);
717 private native String[] _list_partitions (long g)
718 throws LibGuestFSException;
721 * list the LVM physical volumes (PVs)
723 * List all the physical volumes detected. This is the
724 * equivalent of the pvs(8) command.
726 * This returns a list of just the device names that
727 * contain PVs (eg. "/dev/sda2").
729 * See also "g.pvs_full".
731 * @throws LibGuestFSException
733 public String[] pvs ()
734 throws LibGuestFSException
737 throw new LibGuestFSException ("pvs: handle is closed");
740 private native String[] _pvs (long g)
741 throws LibGuestFSException;
744 * list the LVM volume groups (VGs)
746 * List all the volumes groups detected. This is the
747 * equivalent of the vgs(8) command.
749 * This returns a list of just the volume group names that
750 * were detected (eg. "VolGroup00").
752 * See also "g.vgs_full".
754 * @throws LibGuestFSException
756 public String[] vgs ()
757 throws LibGuestFSException
760 throw new LibGuestFSException ("vgs: handle is closed");
763 private native String[] _vgs (long g)
764 throws LibGuestFSException;
767 * list the LVM logical volumes (LVs)
769 * List all the logical volumes detected. This is the
770 * equivalent of the lvs(8) command.
772 * This returns a list of the logical volume device names
773 * (eg. "/dev/VolGroup00/LogVol00").
775 * See also "g.lvs_full".
777 * @throws LibGuestFSException
779 public String[] lvs ()
780 throws LibGuestFSException
783 throw new LibGuestFSException ("lvs: handle is closed");
786 private native String[] _lvs (long g)
787 throws LibGuestFSException;
790 * list the LVM physical volumes (PVs)
792 * List all the physical volumes detected. This is the
793 * equivalent of the pvs(8) command. The "full" version
794 * includes all fields.
796 * @throws LibGuestFSException
798 public PV[] pvs_full ()
799 throws LibGuestFSException
802 throw new LibGuestFSException ("pvs_full: handle is closed");
803 return _pvs_full (g);
805 private native PV[] _pvs_full (long g)
806 throws LibGuestFSException;
809 * list the LVM volume groups (VGs)
811 * List all the volumes groups detected. This is the
812 * equivalent of the vgs(8) command. The "full" version
813 * includes all fields.
815 * @throws LibGuestFSException
817 public VG[] vgs_full ()
818 throws LibGuestFSException
821 throw new LibGuestFSException ("vgs_full: handle is closed");
822 return _vgs_full (g);
824 private native VG[] _vgs_full (long g)
825 throws LibGuestFSException;
828 * list the LVM logical volumes (LVs)
830 * List all the logical volumes detected. This is the
831 * equivalent of the lvs(8) command. The "full" version
832 * includes all fields.
834 * @throws LibGuestFSException
836 public LV[] lvs_full ()
837 throws LibGuestFSException
840 throw new LibGuestFSException ("lvs_full: handle is closed");
841 return _lvs_full (g);
843 private native LV[] _lvs_full (long g)
844 throws LibGuestFSException;
849 * Return the contents of the file named "path".
851 * The file contents are returned as a list of lines.
852 * Trailing "LF" and "CRLF" character sequences are *not*
855 * Note that this function cannot correctly handle binary
856 * files (specifically, files containing "\0" character
857 * which is treated as end of line). For those you need to
858 * use the "g.read_file" function which has a more complex
861 * @throws LibGuestFSException
863 public String[] read_lines (String path)
864 throws LibGuestFSException
867 throw new LibGuestFSException ("read_lines: handle is closed");
868 return _read_lines (g, path);
870 private native String[] _read_lines (long g, String path)
871 throws LibGuestFSException;
874 * create a new Augeas handle
876 * Create a new Augeas handle for editing configuration
877 * files. If there was any previous Augeas handle
878 * associated with this guestfs session, then it is closed.
880 * You must call this before using any other "g.aug_*"
883 * "root" is the filesystem root. "root" must not be NULL,
886 * The flags are the same as the flags defined in
887 * <augeas.h>, the logical *or* of the following integers:
889 * "AUG_SAVE_BACKUP" = 1
890 * Keep the original file with a ".augsave" extension.
892 * "AUG_SAVE_NEWFILE" = 2
893 * Save changes into a file with extension ".augnew",
894 * and do not overwrite original. Overrides
897 * "AUG_TYPE_CHECK" = 4
898 * Typecheck lenses (can be expensive).
900 * "AUG_NO_STDINC" = 8
901 * Do not use standard load path for modules.
903 * "AUG_SAVE_NOOP" = 16
904 * Make save a no-op, just record what would have been
908 * Do not load the tree in "g.aug_init".
910 * To close the handle, you can call "g.aug_close".
912 * To find out more about Augeas, see <http://augeas.net/>.
914 * @throws LibGuestFSException
916 public void aug_init (String root, int flags)
917 throws LibGuestFSException
920 throw new LibGuestFSException ("aug_init: handle is closed");
921 _aug_init (g, root, flags);
923 private native void _aug_init (long g, String root, int flags)
924 throws LibGuestFSException;
927 * close the current Augeas handle
929 * Close the current Augeas handle and free up any
930 * resources used by it. After calling this, you have to
931 * call "g.aug_init" again before you can use any other
934 * @throws LibGuestFSException
936 public void aug_close ()
937 throws LibGuestFSException
940 throw new LibGuestFSException ("aug_close: handle is closed");
943 private native void _aug_close (long g)
944 throws LibGuestFSException;
947 * define an Augeas variable
949 * Defines an Augeas variable "name" whose value is the
950 * result of evaluating "expr". If "expr" is NULL, then
951 * "name" is undefined.
953 * On success this returns the number of nodes in "expr",
954 * or 0 if "expr" evaluates to something which is not a
957 * @throws LibGuestFSException
959 public int aug_defvar (String name, String expr)
960 throws LibGuestFSException
963 throw new LibGuestFSException ("aug_defvar: handle is closed");
964 return _aug_defvar (g, name, expr);
966 private native int _aug_defvar (long g, String name, String expr)
967 throws LibGuestFSException;
970 * define an Augeas node
972 * Defines a variable "name" whose value is the result of
975 * If "expr" evaluates to an empty nodeset, a node is
976 * created, equivalent to calling "g.aug_set" "expr",
977 * "value". "name" will be the nodeset containing that
980 * On success this returns a pair containing the number of
981 * nodes in the nodeset, and a boolean flag if a node was
984 * @throws LibGuestFSException
986 public IntBool aug_defnode (String name, String expr, String val)
987 throws LibGuestFSException
990 throw new LibGuestFSException ("aug_defnode: handle is closed");
991 return _aug_defnode (g, name, expr, val);
993 private native IntBool _aug_defnode (long g, String name, String expr, String val)
994 throws LibGuestFSException;
997 * look up the value of an Augeas path
999 * Look up the value associated with "path". If "path"
1000 * matches exactly one node, the "value" is returned.
1002 * @throws LibGuestFSException
1004 public String aug_get (String path)
1005 throws LibGuestFSException
1008 throw new LibGuestFSException ("aug_get: handle is closed");
1009 return _aug_get (g, path);
1011 private native String _aug_get (long g, String path)
1012 throws LibGuestFSException;
1015 * set Augeas path to value
1017 * Set the value associated with "path" to "value".
1019 * @throws LibGuestFSException
1021 public void aug_set (String path, String val)
1022 throws LibGuestFSException
1025 throw new LibGuestFSException ("aug_set: handle is closed");
1026 _aug_set (g, path, val);
1028 private native void _aug_set (long g, String path, String val)
1029 throws LibGuestFSException;
1032 * insert a sibling Augeas node
1034 * Create a new sibling "label" for "path", inserting it
1035 * into the tree before or after "path" (depending on the
1036 * boolean flag "before").
1038 * "path" must match exactly one existing node in the tree,
1039 * and "label" must be a label, ie. not contain "/", "*" or
1040 * end with a bracketed index "[N]".
1042 * @throws LibGuestFSException
1044 public void aug_insert (String path, String label, boolean before)
1045 throws LibGuestFSException
1048 throw new LibGuestFSException ("aug_insert: handle is closed");
1049 _aug_insert (g, path, label, before);
1051 private native void _aug_insert (long g, String path, String label, boolean before)
1052 throws LibGuestFSException;
1055 * remove an Augeas path
1057 * Remove "path" and all of its children.
1059 * On success this returns the number of entries which were
1062 * @throws LibGuestFSException
1064 public int aug_rm (String path)
1065 throws LibGuestFSException
1068 throw new LibGuestFSException ("aug_rm: handle is closed");
1069 return _aug_rm (g, path);
1071 private native int _aug_rm (long g, String path)
1072 throws LibGuestFSException;
1077 * Move the node "src" to "dest". "src" must match exactly
1078 * one node. "dest" is overwritten if it exists.
1080 * @throws LibGuestFSException
1082 public void aug_mv (String src, String dest)
1083 throws LibGuestFSException
1086 throw new LibGuestFSException ("aug_mv: handle is closed");
1087 _aug_mv (g, src, dest);
1089 private native void _aug_mv (long g, String src, String dest)
1090 throws LibGuestFSException;
1093 * return Augeas nodes which match path
1095 * Returns a list of paths which match the path expression
1096 * "path". The returned paths are sufficiently qualified so
1097 * that they match exactly one node in the current tree.
1099 * @throws LibGuestFSException
1101 public String[] aug_match (String path)
1102 throws LibGuestFSException
1105 throw new LibGuestFSException ("aug_match: handle is closed");
1106 return _aug_match (g, path);
1108 private native String[] _aug_match (long g, String path)
1109 throws LibGuestFSException;
1112 * write all pending Augeas changes to disk
1114 * This writes all pending changes to disk.
1116 * The flags which were passed to "g.aug_init" affect
1117 * exactly how files are saved.
1119 * @throws LibGuestFSException
1121 public void aug_save ()
1122 throws LibGuestFSException
1125 throw new LibGuestFSException ("aug_save: handle is closed");
1128 private native void _aug_save (long g)
1129 throws LibGuestFSException;
1132 * load files into the tree
1134 * Load files into the tree.
1136 * See "aug_load" in the Augeas documentation for the full
1139 * @throws LibGuestFSException
1141 public void aug_load ()
1142 throws LibGuestFSException
1145 throw new LibGuestFSException ("aug_load: handle is closed");
1148 private native void _aug_load (long g)
1149 throws LibGuestFSException;
1152 * list Augeas nodes under a path
1154 * This is just a shortcut for listing "g.aug_match"
1155 * "path/*" and sorting the resulting nodes into
1156 * alphabetical order.
1158 * @throws LibGuestFSException
1160 public String[] aug_ls (String path)
1161 throws LibGuestFSException
1164 throw new LibGuestFSException ("aug_ls: handle is closed");
1165 return _aug_ls (g, path);
1167 private native String[] _aug_ls (long g, String path)
1168 throws LibGuestFSException;
1173 * Remove the single file "path".
1175 * @throws LibGuestFSException
1177 public void rm (String path)
1178 throws LibGuestFSException
1181 throw new LibGuestFSException ("rm: handle is closed");
1184 private native void _rm (long g, String path)
1185 throws LibGuestFSException;
1188 * remove a directory
1190 * Remove the single directory "path".
1192 * @throws LibGuestFSException
1194 public void rmdir (String path)
1195 throws LibGuestFSException
1198 throw new LibGuestFSException ("rmdir: handle is closed");
1201 private native void _rmdir (long g, String path)
1202 throws LibGuestFSException;
1205 * remove a file or directory recursively
1207 * Remove the file or directory "path", recursively
1208 * removing the contents if its a directory. This is like
1209 * the "rm -rf" shell command.
1211 * @throws LibGuestFSException
1213 public void rm_rf (String path)
1214 throws LibGuestFSException
1217 throw new LibGuestFSException ("rm_rf: handle is closed");
1220 private native void _rm_rf (long g, String path)
1221 throws LibGuestFSException;
1224 * create a directory
1226 * Create a directory named "path".
1228 * @throws LibGuestFSException
1230 public void mkdir (String path)
1231 throws LibGuestFSException
1234 throw new LibGuestFSException ("mkdir: handle is closed");
1237 private native void _mkdir (long g, String path)
1238 throws LibGuestFSException;
1241 * create a directory and parents
1243 * Create a directory named "path", creating any parent
1244 * directories as necessary. This is like the "mkdir -p"
1247 * @throws LibGuestFSException
1249 public void mkdir_p (String path)
1250 throws LibGuestFSException
1253 throw new LibGuestFSException ("mkdir_p: handle is closed");
1256 private native void _mkdir_p (long g, String path)
1257 throws LibGuestFSException;
1262 * Change the mode (permissions) of "path" to "mode". Only
1263 * numeric modes are supported.
1265 * @throws LibGuestFSException
1267 public void chmod (int mode, String path)
1268 throws LibGuestFSException
1271 throw new LibGuestFSException ("chmod: handle is closed");
1272 _chmod (g, mode, path);
1274 private native void _chmod (long g, int mode, String path)
1275 throws LibGuestFSException;
1278 * change file owner and group
1280 * Change the file owner to "owner" and group to "group".
1282 * Only numeric uid and gid are supported. If you want to
1283 * use names, you will need to locate and parse the
1284 * password file yourself (Augeas support makes this
1287 * @throws LibGuestFSException
1289 public void chown (int owner, int group, String path)
1290 throws LibGuestFSException
1293 throw new LibGuestFSException ("chown: handle is closed");
1294 _chown (g, owner, group, path);
1296 private native void _chown (long g, int owner, int group, String path)
1297 throws LibGuestFSException;
1300 * test if file or directory exists
1302 * This returns "true" if and only if there is a file,
1303 * directory (or anything) with the given "path" name.
1305 * See also "g.is_file", "g.is_dir", "g.stat".
1307 * @throws LibGuestFSException
1309 public boolean exists (String path)
1310 throws LibGuestFSException
1313 throw new LibGuestFSException ("exists: handle is closed");
1314 return _exists (g, path);
1316 private native boolean _exists (long g, String path)
1317 throws LibGuestFSException;
1320 * test if file exists
1322 * This returns "true" if and only if there is a file with
1323 * the given "path" name. Note that it returns false for
1324 * other objects like directories.
1326 * See also "g.stat".
1328 * @throws LibGuestFSException
1330 public boolean is_file (String path)
1331 throws LibGuestFSException
1334 throw new LibGuestFSException ("is_file: handle is closed");
1335 return _is_file (g, path);
1337 private native boolean _is_file (long g, String path)
1338 throws LibGuestFSException;
1341 * test if file exists
1343 * This returns "true" if and only if there is a directory
1344 * with the given "path" name. Note that it returns false
1345 * for other objects like files.
1347 * See also "g.stat".
1349 * @throws LibGuestFSException
1351 public boolean is_dir (String path)
1352 throws LibGuestFSException
1355 throw new LibGuestFSException ("is_dir: handle is closed");
1356 return _is_dir (g, path);
1358 private native boolean _is_dir (long g, String path)
1359 throws LibGuestFSException;
1362 * create an LVM physical volume
1364 * This creates an LVM physical volume on the named
1365 * "device", where "device" should usually be a partition
1366 * name such as "/dev/sda1".
1368 * @throws LibGuestFSException
1370 public void pvcreate (String device)
1371 throws LibGuestFSException
1374 throw new LibGuestFSException ("pvcreate: handle is closed");
1375 _pvcreate (g, device);
1377 private native void _pvcreate (long g, String device)
1378 throws LibGuestFSException;
1381 * create an LVM volume group
1383 * This creates an LVM volume group called "volgroup" from
1384 * the non-empty list of physical volumes "physvols".
1386 * @throws LibGuestFSException
1388 public void vgcreate (String volgroup, String[] physvols)
1389 throws LibGuestFSException
1392 throw new LibGuestFSException ("vgcreate: handle is closed");
1393 _vgcreate (g, volgroup, physvols);
1395 private native void _vgcreate (long g, String volgroup, String[] physvols)
1396 throws LibGuestFSException;
1399 * create an LVM volume group
1401 * This creates an LVM volume group called "logvol" on the
1402 * volume group "volgroup", with "size" megabytes.
1404 * @throws LibGuestFSException
1406 public void lvcreate (String logvol, String volgroup, int mbytes)
1407 throws LibGuestFSException
1410 throw new LibGuestFSException ("lvcreate: handle is closed");
1411 _lvcreate (g, logvol, volgroup, mbytes);
1413 private native void _lvcreate (long g, String logvol, String volgroup, int mbytes)
1414 throws LibGuestFSException;
1419 * This creates a filesystem on "device" (usually a
1420 * partition of LVM logical volume). The filesystem type is
1421 * "fstype", for example "ext3".
1423 * @throws LibGuestFSException
1425 public void mkfs (String fstype, String device)
1426 throws LibGuestFSException
1429 throw new LibGuestFSException ("mkfs: handle is closed");
1430 _mkfs (g, fstype, device);
1432 private native void _mkfs (long g, String fstype, String device)
1433 throws LibGuestFSException;
1436 * create partitions on a block device
1438 * This is a direct interface to the sfdisk(8) program for
1439 * creating partitions on block devices.
1441 * "device" should be a block device, for example
1444 * "cyls", "heads" and "sectors" are the number of
1445 * cylinders, heads and sectors on the device, which are
1446 * passed directly to sfdisk as the *-C*, *-H* and *-S*
1447 * parameters. If you pass 0 for any of these, then the
1448 * corresponding parameter is omitted. Usually for 'large'
1449 * disks, you can just pass 0 for these, but for small
1450 * (floppy-sized) disks, sfdisk (or rather, the kernel)
1451 * cannot work out the right geometry and you will need to
1454 * "lines" is a list of lines that we feed to "sfdisk". For
1455 * more information refer to the sfdisk(8) manpage.
1457 * To create a single partition occupying the whole disk,
1458 * you would pass "lines" as a single element list, when
1459 * the single element being the string "," (comma).
1461 * This command is dangerous. Without careful use you can
1462 * easily destroy all your data.
1464 * @throws LibGuestFSException
1466 public void sfdisk (String device, int cyls, int heads, int sectors, String[] lines)
1467 throws LibGuestFSException
1470 throw new LibGuestFSException ("sfdisk: handle is closed");
1471 _sfdisk (g, device, cyls, heads, sectors, lines);
1473 private native void _sfdisk (long g, String device, int cyls, int heads, int sectors, String[] lines)
1474 throws LibGuestFSException;
1479 * This call creates a file called "path". The contents of
1480 * the file is the string "content" (which can contain any
1481 * 8 bit data), with length "size".
1483 * As a special case, if "size" is 0 then the length is
1484 * calculated using "strlen" (so in this case the content
1485 * cannot contain embedded ASCII NULs).
1487 * Because of the message protocol, there is a transfer
1488 * limit of somewhere between 2MB and 4MB. To transfer
1489 * large files you should use FTP.
1491 * @throws LibGuestFSException
1493 public void write_file (String path, String content, int size)
1494 throws LibGuestFSException
1497 throw new LibGuestFSException ("write_file: handle is closed");
1498 _write_file (g, path, content, size);
1500 private native void _write_file (long g, String path, String content, int size)
1501 throws LibGuestFSException;
1504 * unmount a filesystem
1506 * This unmounts the given filesystem. The filesystem may
1507 * be specified either by its mountpoint (path) or the
1508 * device which contains the filesystem.
1510 * @throws LibGuestFSException
1512 public void umount (String pathordevice)
1513 throws LibGuestFSException
1516 throw new LibGuestFSException ("umount: handle is closed");
1517 _umount (g, pathordevice);
1519 private native void _umount (long g, String pathordevice)
1520 throws LibGuestFSException;
1523 * show mounted filesystems
1525 * This returns the list of currently mounted filesystems.
1526 * It returns the list of devices (eg. "/dev/sda1",
1529 * Some internal mounts are not shown.
1531 * @throws LibGuestFSException
1533 public String[] mounts ()
1534 throws LibGuestFSException
1537 throw new LibGuestFSException ("mounts: handle is closed");
1540 private native String[] _mounts (long g)
1541 throws LibGuestFSException;
1544 * unmount all filesystems
1546 * This unmounts all mounted filesystems.
1548 * Some internal mounts are not unmounted by this call.
1550 * @throws LibGuestFSException
1552 public void umount_all ()
1553 throws LibGuestFSException
1556 throw new LibGuestFSException ("umount_all: handle is closed");
1559 private native void _umount_all (long g)
1560 throws LibGuestFSException;
1563 * remove all LVM LVs, VGs and PVs
1565 * This command removes all LVM logical volumes, volume
1566 * groups and physical volumes.
1568 * This command is dangerous. Without careful use you can
1569 * easily destroy all your data.
1571 * @throws LibGuestFSException
1573 public void lvm_remove_all ()
1574 throws LibGuestFSException
1577 throw new LibGuestFSException ("lvm_remove_all: handle is closed");
1578 _lvm_remove_all (g);
1580 private native void _lvm_remove_all (long g)
1581 throws LibGuestFSException;
1584 * determine file type
1586 * This call uses the standard file(1) command to determine
1587 * the type or contents of the file. This also works on
1588 * devices, for example to find out whether a partition
1589 * contains a filesystem.
1591 * The exact command which runs is "file -bsL path". Note
1592 * in particular that the filename is not prepended to the
1593 * output (the "-b" option).
1595 * @throws LibGuestFSException
1597 public String file (String path)
1598 throws LibGuestFSException
1601 throw new LibGuestFSException ("file: handle is closed");
1602 return _file (g, path);
1604 private native String _file (long g, String path)
1605 throws LibGuestFSException;
1608 * run a command from the guest filesystem
1610 * This call runs a command from the guest filesystem. The
1611 * filesystem must be mounted, and must contain a
1612 * compatible operating system (ie. something Linux, with
1613 * the same or compatible processor architecture).
1615 * The single parameter is an argv-style list of arguments.
1616 * The first element is the name of the program to run.
1617 * Subsequent elements are parameters. The list must be
1618 * non-empty (ie. must contain a program name).
1620 * The $PATH environment variable will contain at least
1621 * "/usr/bin" and "/bin". If you require a program from
1622 * another location, you should provide the full path in
1623 * the first parameter.
1625 * Shared libraries and data files required by the program
1626 * must be available on filesystems which are mounted in
1627 * the correct places. It is the caller's responsibility to
1628 * ensure all filesystems that are needed are mounted at
1629 * the right locations.
1631 * @throws LibGuestFSException
1633 public String command (String[] arguments)
1634 throws LibGuestFSException
1637 throw new LibGuestFSException ("command: handle is closed");
1638 return _command (g, arguments);
1640 private native String _command (long g, String[] arguments)
1641 throws LibGuestFSException;
1644 * run a command, returning lines
1646 * This is the same as "g.command", but splits the result
1647 * into a list of lines.
1649 * @throws LibGuestFSException
1651 public String[] command_lines (String[] arguments)
1652 throws LibGuestFSException
1655 throw new LibGuestFSException ("command_lines: handle is closed");
1656 return _command_lines (g, arguments);
1658 private native String[] _command_lines (long g, String[] arguments)
1659 throws LibGuestFSException;
1662 * get file information
1664 * Returns file information for the given "path".
1666 * This is the same as the stat(2) system call.
1668 * @throws LibGuestFSException
1670 public Stat stat (String path)
1671 throws LibGuestFSException
1674 throw new LibGuestFSException ("stat: handle is closed");
1675 return _stat (g, path);
1677 private native Stat _stat (long g, String path)
1678 throws LibGuestFSException;
1681 * get file information for a symbolic link
1683 * Returns file information for the given "path".
1685 * This is the same as "g.stat" except that if "path" is a
1686 * symbolic link, then the link is stat-ed, not the file it
1689 * This is the same as the lstat(2) system call.
1691 * @throws LibGuestFSException
1693 public Stat lstat (String path)
1694 throws LibGuestFSException
1697 throw new LibGuestFSException ("lstat: handle is closed");
1698 return _lstat (g, path);
1700 private native Stat _lstat (long g, String path)
1701 throws LibGuestFSException;
1704 * get file system statistics
1706 * Returns file system statistics for any mounted file
1707 * system. "path" should be a file or directory in the
1708 * mounted file system (typically it is the mount point
1709 * itself, but it doesn't need to be).
1711 * This is the same as the statvfs(2) system call.
1713 * @throws LibGuestFSException
1715 public StatVFS statvfs (String path)
1716 throws LibGuestFSException
1719 throw new LibGuestFSException ("statvfs: handle is closed");
1720 return _statvfs (g, path);
1722 private native StatVFS _statvfs (long g, String path)
1723 throws LibGuestFSException;
1726 * get ext2/ext3/ext4 superblock details
1728 * This returns the contents of the ext2, ext3 or ext4
1729 * filesystem superblock on "device".
1731 * It is the same as running "tune2fs -l device". See
1732 * tune2fs(8) manpage for more details. The list of fields
1733 * returned isn't clearly defined, and depends on both the
1734 * version of "tune2fs" that libguestfs was built against,
1735 * and the filesystem itself.
1737 * @throws LibGuestFSException
1739 public HashMap<String,String> tune2fs_l (String device)
1740 throws LibGuestFSException
1743 throw new LibGuestFSException ("tune2fs_l: handle is closed");
1744 return _tune2fs_l (g, device);
1746 private native HashMap<String,String> _tune2fs_l (long g, String device)
1747 throws LibGuestFSException;
1750 * set block device to read-only
1752 * Sets the block device named "device" to read-only.
1754 * This uses the blockdev(8) command.
1756 * @throws LibGuestFSException
1758 public void blockdev_setro (String device)
1759 throws LibGuestFSException
1762 throw new LibGuestFSException ("blockdev_setro: handle is closed");
1763 _blockdev_setro (g, device);
1765 private native void _blockdev_setro (long g, String device)
1766 throws LibGuestFSException;
1769 * set block device to read-write
1771 * Sets the block device named "device" to read-write.
1773 * This uses the blockdev(8) command.
1775 * @throws LibGuestFSException
1777 public void blockdev_setrw (String device)
1778 throws LibGuestFSException
1781 throw new LibGuestFSException ("blockdev_setrw: handle is closed");
1782 _blockdev_setrw (g, device);
1784 private native void _blockdev_setrw (long g, String device)
1785 throws LibGuestFSException;
1788 * is block device set to read-only
1790 * Returns a boolean indicating if the block device is
1791 * read-only (true if read-only, false if not).
1793 * This uses the blockdev(8) command.
1795 * @throws LibGuestFSException
1797 public boolean blockdev_getro (String device)
1798 throws LibGuestFSException
1801 throw new LibGuestFSException ("blockdev_getro: handle is closed");
1802 return _blockdev_getro (g, device);
1804 private native boolean _blockdev_getro (long g, String device)
1805 throws LibGuestFSException;
1808 * get sectorsize of block device
1810 * This returns the size of sectors on a block device.
1811 * Usually 512, but can be larger for modern devices.
1813 * (Note, this is not the size in sectors, use
1814 * "g.blockdev_getsz" for that).
1816 * This uses the blockdev(8) command.
1818 * @throws LibGuestFSException
1820 public int blockdev_getss (String device)
1821 throws LibGuestFSException
1824 throw new LibGuestFSException ("blockdev_getss: handle is closed");
1825 return _blockdev_getss (g, device);
1827 private native int _blockdev_getss (long g, String device)
1828 throws LibGuestFSException;
1831 * get blocksize of block device
1833 * This returns the block size of a device.
1835 * (Note this is different from both *size in blocks* and
1836 * *filesystem block size*).
1838 * This uses the blockdev(8) command.
1840 * @throws LibGuestFSException
1842 public int blockdev_getbsz (String device)
1843 throws LibGuestFSException
1846 throw new LibGuestFSException ("blockdev_getbsz: handle is closed");
1847 return _blockdev_getbsz (g, device);
1849 private native int _blockdev_getbsz (long g, String device)
1850 throws LibGuestFSException;
1853 * set blocksize of block device
1855 * This sets the block size of a device.
1857 * (Note this is different from both *size in blocks* and
1858 * *filesystem block size*).
1860 * This uses the blockdev(8) command.
1862 * @throws LibGuestFSException
1864 public void blockdev_setbsz (String device, int blocksize)
1865 throws LibGuestFSException
1868 throw new LibGuestFSException ("blockdev_setbsz: handle is closed");
1869 _blockdev_setbsz (g, device, blocksize);
1871 private native void _blockdev_setbsz (long g, String device, int blocksize)
1872 throws LibGuestFSException;
1875 * get total size of device in 512-byte sectors
1877 * This returns the size of the device in units of 512-byte
1878 * sectors (even if the sectorsize isn't 512 bytes ...
1881 * See also "g.blockdev_getss" for the real sector size of
1882 * the device, and "g.blockdev_getsize64" for the more
1883 * useful *size in bytes*.
1885 * This uses the blockdev(8) command.
1887 * @throws LibGuestFSException
1889 public long blockdev_getsz (String device)
1890 throws LibGuestFSException
1893 throw new LibGuestFSException ("blockdev_getsz: handle is closed");
1894 return _blockdev_getsz (g, device);
1896 private native long _blockdev_getsz (long g, String device)
1897 throws LibGuestFSException;
1900 * get total size of device in bytes
1902 * This returns the size of the device in bytes.
1904 * See also "g.blockdev_getsz".
1906 * This uses the blockdev(8) command.
1908 * @throws LibGuestFSException
1910 public long blockdev_getsize64 (String device)
1911 throws LibGuestFSException
1914 throw new LibGuestFSException ("blockdev_getsize64: handle is closed");
1915 return _blockdev_getsize64 (g, device);
1917 private native long _blockdev_getsize64 (long g, String device)
1918 throws LibGuestFSException;
1921 * flush device buffers
1923 * This tells the kernel to flush internal buffers
1924 * associated with "device".
1926 * This uses the blockdev(8) command.
1928 * @throws LibGuestFSException
1930 public void blockdev_flushbufs (String device)
1931 throws LibGuestFSException
1934 throw new LibGuestFSException ("blockdev_flushbufs: handle is closed");
1935 _blockdev_flushbufs (g, device);
1937 private native void _blockdev_flushbufs (long g, String device)
1938 throws LibGuestFSException;
1941 * reread partition table
1943 * Reread the partition table on "device".
1945 * This uses the blockdev(8) command.
1947 * @throws LibGuestFSException
1949 public void blockdev_rereadpt (String device)
1950 throws LibGuestFSException
1953 throw new LibGuestFSException ("blockdev_rereadpt: handle is closed");
1954 _blockdev_rereadpt (g, device);
1956 private native void _blockdev_rereadpt (long g, String device)
1957 throws LibGuestFSException;
1960 * upload a file from the local machine
1962 * Upload local file "filename" to "remotefilename" on the
1965 * "filename" can also be a named pipe.
1967 * See also "g.download".
1969 * @throws LibGuestFSException
1971 public void upload (String filename, String remotefilename)
1972 throws LibGuestFSException
1975 throw new LibGuestFSException ("upload: handle is closed");
1976 _upload (g, filename, remotefilename);
1978 private native void _upload (long g, String filename, String remotefilename)
1979 throws LibGuestFSException;
1982 * download a file to the local machine
1984 * Download file "remotefilename" and save it as "filename"
1985 * on the local machine.
1987 * "filename" can also be a named pipe.
1989 * See also "g.upload", "g.cat".
1991 * @throws LibGuestFSException
1993 public void download (String remotefilename, String filename)
1994 throws LibGuestFSException
1997 throw new LibGuestFSException ("download: handle is closed");
1998 _download (g, remotefilename, filename);
2000 private native void _download (long g, String remotefilename, String filename)
2001 throws LibGuestFSException;
2004 * compute MD5, SHAx or CRC checksum of file
2006 * This call computes the MD5, SHAx or CRC checksum of the
2007 * file named "path".
2009 * The type of checksum to compute is given by the
2010 * "csumtype" parameter which must have one of the
2014 * Compute the cyclic redundancy check (CRC) specified
2015 * by POSIX for the "cksum" command.
2018 * Compute the MD5 hash (using the "md5sum" program).
2021 * Compute the SHA1 hash (using the "sha1sum" program).
2024 * Compute the SHA224 hash (using the "sha224sum"
2028 * Compute the SHA256 hash (using the "sha256sum"
2032 * Compute the SHA384 hash (using the "sha384sum"
2036 * Compute the SHA512 hash (using the "sha512sum"
2039 * The checksum is returned as a printable string.
2041 * @throws LibGuestFSException
2043 public String checksum (String csumtype, String path)
2044 throws LibGuestFSException
2047 throw new LibGuestFSException ("checksum: handle is closed");
2048 return _checksum (g, csumtype, path);
2050 private native String _checksum (long g, String csumtype, String path)
2051 throws LibGuestFSException;
2054 * unpack tarfile to directory
2056 * This command uploads and unpacks local file "tarfile"
2057 * (an *uncompressed* tar file) into "directory".
2059 * To upload a compressed tarball, use "g.tgz_in".
2061 * @throws LibGuestFSException
2063 public void tar_in (String tarfile, String directory)
2064 throws LibGuestFSException
2067 throw new LibGuestFSException ("tar_in: handle is closed");
2068 _tar_in (g, tarfile, directory);
2070 private native void _tar_in (long g, String tarfile, String directory)
2071 throws LibGuestFSException;
2074 * pack directory into tarfile
2076 * This command packs the contents of "directory" and
2077 * downloads it to local file "tarfile".
2079 * To download a compressed tarball, use "g.tgz_out".
2081 * @throws LibGuestFSException
2083 public void tar_out (String directory, String tarfile)
2084 throws LibGuestFSException
2087 throw new LibGuestFSException ("tar_out: handle is closed");
2088 _tar_out (g, directory, tarfile);
2090 private native void _tar_out (long g, String directory, String tarfile)
2091 throws LibGuestFSException;
2094 * unpack compressed tarball to directory
2096 * This command uploads and unpacks local file "tarball" (a
2097 * *gzip compressed* tar file) into "directory".
2099 * To upload an uncompressed tarball, use "g.tar_in".
2101 * @throws LibGuestFSException
2103 public void tgz_in (String tarball, String directory)
2104 throws LibGuestFSException
2107 throw new LibGuestFSException ("tgz_in: handle is closed");
2108 _tgz_in (g, tarball, directory);
2110 private native void _tgz_in (long g, String tarball, String directory)
2111 throws LibGuestFSException;
2114 * pack directory into compressed tarball
2116 * This command packs the contents of "directory" and
2117 * downloads it to local file "tarball".
2119 * To download an uncompressed tarball, use "g.tar_out".
2121 * @throws LibGuestFSException
2123 public void tgz_out (String directory, String tarball)
2124 throws LibGuestFSException
2127 throw new LibGuestFSException ("tgz_out: handle is closed");
2128 _tgz_out (g, directory, tarball);
2130 private native void _tgz_out (long g, String directory, String tarball)
2131 throws LibGuestFSException;
2134 * mount a guest disk, read-only
2136 * This is the same as the "g.mount" command, but it mounts
2137 * the filesystem with the read-only (*-o ro*) flag.
2139 * @throws LibGuestFSException
2141 public void mount_ro (String device, String mountpoint)
2142 throws LibGuestFSException
2145 throw new LibGuestFSException ("mount_ro: handle is closed");
2146 _mount_ro (g, device, mountpoint);
2148 private native void _mount_ro (long g, String device, String mountpoint)
2149 throws LibGuestFSException;
2152 * mount a guest disk with mount options
2154 * This is the same as the "g.mount" command, but it allows
2155 * you to set the mount options as for the mount(8) *-o*
2158 * @throws LibGuestFSException
2160 public void mount_options (String options, String device, String mountpoint)
2161 throws LibGuestFSException
2164 throw new LibGuestFSException ("mount_options: handle is closed");
2165 _mount_options (g, options, device, mountpoint);
2167 private native void _mount_options (long g, String options, String device, String mountpoint)
2168 throws LibGuestFSException;
2171 * mount a guest disk with mount options and vfstype
2173 * This is the same as the "g.mount" command, but it allows
2174 * you to set both the mount options and the vfstype as for
2175 * the mount(8) *-o* and *-t* flags.
2177 * @throws LibGuestFSException
2179 public void mount_vfs (String options, String vfstype, String device, String mountpoint)
2180 throws LibGuestFSException
2183 throw new LibGuestFSException ("mount_vfs: handle is closed");
2184 _mount_vfs (g, options, vfstype, device, mountpoint);
2186 private native void _mount_vfs (long g, String options, String vfstype, String device, String mountpoint)
2187 throws LibGuestFSException;
2190 * debugging and internals
2192 * The "g.debug" command exposes some internals of
2193 * "guestfsd" (the guestfs daemon) that runs inside the
2196 * There is no comprehensive help for this command. You
2197 * have to look at the file "daemon/debug.c" in the
2198 * libguestfs source to find out what you can do.
2200 * @throws LibGuestFSException
2202 public String debug (String subcmd, String[] extraargs)
2203 throws LibGuestFSException
2206 throw new LibGuestFSException ("debug: handle is closed");
2207 return _debug (g, subcmd, extraargs);
2209 private native String _debug (long g, String subcmd, String[] extraargs)
2210 throws LibGuestFSException;
2213 * remove an LVM logical volume
2215 * Remove an LVM logical volume "device", where "device" is
2216 * the path to the LV, such as "/dev/VG/LV".
2218 * You can also remove all LVs in a volume group by
2219 * specifying the VG name, "/dev/VG".
2221 * @throws LibGuestFSException
2223 public void lvremove (String device)
2224 throws LibGuestFSException
2227 throw new LibGuestFSException ("lvremove: handle is closed");
2228 _lvremove (g, device);
2230 private native void _lvremove (long g, String device)
2231 throws LibGuestFSException;
2234 * remove an LVM volume group
2236 * Remove an LVM volume group "vgname", (for example "VG").
2238 * This also forcibly removes all logical volumes in the
2239 * volume group (if any).
2241 * @throws LibGuestFSException
2243 public void vgremove (String vgname)
2244 throws LibGuestFSException
2247 throw new LibGuestFSException ("vgremove: handle is closed");
2248 _vgremove (g, vgname);
2250 private native void _vgremove (long g, String vgname)
2251 throws LibGuestFSException;
2254 * remove an LVM physical volume
2256 * This wipes a physical volume "device" so that LVM will
2257 * no longer recognise it.
2259 * The implementation uses the "pvremove" command which
2260 * refuses to wipe physical volumes that contain any volume
2261 * groups, so you have to remove those first.
2263 * @throws LibGuestFSException
2265 public void pvremove (String device)
2266 throws LibGuestFSException
2269 throw new LibGuestFSException ("pvremove: handle is closed");
2270 _pvremove (g, device);
2272 private native void _pvremove (long g, String device)
2273 throws LibGuestFSException;
2276 * set the ext2/3/4 filesystem label
2278 * This sets the ext2/3/4 filesystem label of the
2279 * filesystem on "device" to "label". Filesystem labels are
2280 * limited to 16 characters.
2282 * You can use either "g.tune2fs_l" or "g.get_e2label" to
2283 * return the existing label on a filesystem.
2285 * @throws LibGuestFSException
2287 public void set_e2label (String device, String label)
2288 throws LibGuestFSException
2291 throw new LibGuestFSException ("set_e2label: handle is closed");
2292 _set_e2label (g, device, label);
2294 private native void _set_e2label (long g, String device, String label)
2295 throws LibGuestFSException;
2298 * get the ext2/3/4 filesystem label
2300 * This returns the ext2/3/4 filesystem label of the
2301 * filesystem on "device".
2303 * @throws LibGuestFSException
2305 public String get_e2label (String device)
2306 throws LibGuestFSException
2309 throw new LibGuestFSException ("get_e2label: handle is closed");
2310 return _get_e2label (g, device);
2312 private native String _get_e2label (long g, String device)
2313 throws LibGuestFSException;
2316 * set the ext2/3/4 filesystem UUID
2318 * This sets the ext2/3/4 filesystem UUID of the filesystem
2319 * on "device" to "uuid". The format of the UUID and
2320 * alternatives such as "clear", "random" and "time" are
2321 * described in the tune2fs(8) manpage.
2323 * You can use either "g.tune2fs_l" or "g.get_e2uuid" to
2324 * return the existing UUID of a filesystem.
2326 * @throws LibGuestFSException
2328 public void set_e2uuid (String device, String uuid)
2329 throws LibGuestFSException
2332 throw new LibGuestFSException ("set_e2uuid: handle is closed");
2333 _set_e2uuid (g, device, uuid);
2335 private native void _set_e2uuid (long g, String device, String uuid)
2336 throws LibGuestFSException;
2339 * get the ext2/3/4 filesystem UUID
2341 * This returns the ext2/3/4 filesystem UUID of the
2342 * filesystem on "device".
2344 * @throws LibGuestFSException
2346 public String get_e2uuid (String device)
2347 throws LibGuestFSException
2350 throw new LibGuestFSException ("get_e2uuid: handle is closed");
2351 return _get_e2uuid (g, device);
2353 private native String _get_e2uuid (long g, String device)
2354 throws LibGuestFSException;