+ /**
+ * run the filesystem checker
+ * <p>
+ * This runs the filesystem checker (fsck) on "device"
+ * which should have filesystem type "fstype".
+ * <p>
+ * The returned integer is the status. See fsck(8) for the
+ * list of status codes from "fsck".
+ * <p>
+ * Notes:
+ * <p>
+ * * Multiple status codes can be summed together.
+ * <p>
+ * * A non-zero return code can mean "success", for
+ * example if errors have been corrected on the
+ * filesystem.
+ * <p>
+ * * Checking or repairing NTFS volumes is not supported
+ * (by linux-ntfs).
+ * <p>
+ * This command is entirely equivalent to running "fsck -a
+ * -t fstype device".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int fsck (String fstype, String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("fsck: handle is closed");
+ return _fsck (g, fstype, device);
+ }
+ private native int _fsck (long g, String fstype, String device)
+ throws LibGuestFSException;
+
+ /**
+ * write zeroes to the device
+ * <p>
+ * This command writes zeroes over the first few blocks of
+ * "device".
+ * <p>
+ * How many blocks are zeroed isn't specified (but it's
+ * *not* enough to securely wipe the device). It should be
+ * sufficient to remove any partition tables, filesystem
+ * superblocks and so on.
+ * <p>
+ * See also: "g.scrub_device".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void zero (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("zero: handle is closed");
+ _zero (g, device);
+ }
+ private native void _zero (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * install GRUB
+ * <p>
+ * This command installs GRUB (the Grand Unified
+ * Bootloader) on "device", with the root directory being
+ * "root".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void grub_install (String root, String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("grub_install: handle is closed");
+ _grub_install (g, root, device);
+ }
+ private native void _grub_install (long g, String root, String device)
+ throws LibGuestFSException;
+
+ /**
+ * copy a file
+ * <p>
+ * This copies a file from "src" to "dest" where "dest" is
+ * either a destination filename or destination directory.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void cp (String src, String dest)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("cp: handle is closed");
+ _cp (g, src, dest);
+ }
+ private native void _cp (long g, String src, String dest)
+ throws LibGuestFSException;
+
+ /**
+ * copy a file or directory recursively
+ * <p>
+ * This copies a file or directory from "src" to "dest"
+ * recursively using the "cp -a" command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void cp_a (String src, String dest)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("cp_a: handle is closed");
+ _cp_a (g, src, dest);
+ }
+ private native void _cp_a (long g, String src, String dest)
+ throws LibGuestFSException;
+
+ /**
+ * move a file
+ * <p>
+ * This moves a file from "src" to "dest" where "dest" is
+ * either a destination filename or destination directory.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mv (String src, String dest)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mv: handle is closed");
+ _mv (g, src, dest);
+ }
+ private native void _mv (long g, String src, String dest)
+ throws LibGuestFSException;
+
+ /**
+ * drop kernel page cache, dentries and inodes
+ * <p>
+ * This instructs the guest kernel to drop its page cache,
+ * and/or dentries and inode caches. The parameter
+ * "whattodrop" tells the kernel what precisely to drop,
+ * see <http://linux-mm.org/Drop_Caches>
+ * <p>
+ * Setting "whattodrop" to 3 should drop everything.
+ * <p>
+ * This automatically calls sync(2) before the operation,
+ * so that the maximum guest memory is freed.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void drop_caches (int whattodrop)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("drop_caches: handle is closed");
+ _drop_caches (g, whattodrop);
+ }
+ private native void _drop_caches (long g, int whattodrop)
+ throws LibGuestFSException;
+
+ /**
+ * return kernel messages
+ * <p>
+ * This returns the kernel messages ("dmesg" output) from
+ * the guest kernel. This is sometimes useful for extended
+ * debugging of problems.
+ * <p>
+ * Another way to get the same information is to enable
+ * verbose messages with "g.set_verbose" or by setting the
+ * environment variable "LIBGUESTFS_DEBUG=1" before running
+ * the program.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String dmesg ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("dmesg: handle is closed");
+ return _dmesg (g);
+ }
+ private native String _dmesg (long g)
+ throws LibGuestFSException;
+
+ /**
+ * ping the guest daemon
+ * <p>
+ * This is a test probe into the guestfs daemon running
+ * inside the qemu subprocess. Calling this function checks
+ * that the daemon responds to the ping message, without
+ * affecting the daemon or attached block device(s) in any
+ * other way.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void ping_daemon ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("ping_daemon: handle is closed");
+ _ping_daemon (g);
+ }
+ private native void _ping_daemon (long g)
+ throws LibGuestFSException;
+
+ /**
+ * test if two files have equal contents
+ * <p>
+ * This compares the two files "file1" and "file2" and
+ * returns true if their content is exactly equal, or false
+ * otherwise.
+ * <p>
+ * The external cmp(1) program is used for the comparison.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public boolean equal (String file1, String file2)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("equal: handle is closed");
+ return _equal (g, file1, file2);
+ }
+ private native boolean _equal (long g, String file1, String file2)
+ throws LibGuestFSException;
+
+ /**
+ * print the printable strings in a file
+ * <p>
+ * This runs the strings(1) command on a file and returns
+ * the list of printable strings found.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] strings (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("strings: handle is closed");
+ return _strings (g, path);
+ }
+ private native String[] _strings (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * print the printable strings in a file
+ * <p>
+ * This is like the "g.strings" command, but allows you to
+ * specify the encoding.
+ * <p>
+ * See the strings(1) manpage for the full list of
+ * encodings.
+ * <p>
+ * Commonly useful encodings are "l" (lower case L) which
+ * will show strings inside Windows/x86 files.
+ * <p>
+ * The returned strings are transcoded to UTF-8.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] strings_e (String encoding, String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("strings_e: handle is closed");
+ return _strings_e (g, encoding, path);
+ }
+ private native String[] _strings_e (long g, String encoding, String path)
+ throws LibGuestFSException;
+
+ /**
+ * dump a file in hexadecimal
+ * <p>
+ * This runs "hexdump -C" on the given "path". The result
+ * is the human-readable, canonical hex dump of the file.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String hexdump (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("hexdump: handle is closed");
+ return _hexdump (g, path);
+ }
+ private native String _hexdump (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * zero unused inodes and disk blocks on ext2/3 filesystem
+ * <p>
+ * This runs the *zerofree* program on "device". This
+ * program claims to zero unused inodes and disk blocks on
+ * an ext2/3 filesystem, thus making it possible to
+ * compress the filesystem more effectively.
+ * <p>
+ * You should not run this program if the filesystem is
+ * mounted.
+ * <p>
+ * It is possible that using this program can damage the
+ * filesystem or data on the filesystem.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void zerofree (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("zerofree: handle is closed");
+ _zerofree (g, device);
+ }
+ private native void _zerofree (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * resize an LVM physical volume
+ * <p>
+ * This resizes (expands or shrinks) an existing LVM
+ * physical volume to match the new size of the underlying
+ * device.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void pvresize (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("pvresize: handle is closed");
+ _pvresize (g, device);
+ }
+ private native void _pvresize (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * modify a single partition on a block device
+ * <p>
+ * This runs sfdisk(8) option to modify just the single
+ * partition "n" (note: "n" counts from 1).
+ * <p>
+ * For other parameters, see "g.sfdisk". You should usually
+ * pass 0 for the cyls/heads/sectors parameters.
+ * <p>
+ * This command is dangerous. Without careful use you can
+ * easily destroy all your data.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void sfdisk_N (String device, int partnum, int cyls, int heads, int sectors, String line)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sfdisk_N: handle is closed");
+ _sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
+ }
+ private native void _sfdisk_N (long g, String device, int partnum, int cyls, int heads, int sectors, String line)
+ throws LibGuestFSException;
+
+ /**
+ * display the partition table
+ * <p>
+ * This displays the partition table on "device", in the
+ * human-readable output of the sfdisk(8) command. It is
+ * not intended to be parsed.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String sfdisk_l (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sfdisk_l: handle is closed");
+ return _sfdisk_l (g, device);
+ }
+ private native String _sfdisk_l (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * display the kernel geometry
+ * <p>
+ * This displays the kernel's idea of the geometry of
+ * "device".
+ * <p>
+ * The result is in human-readable format, and not designed
+ * to be parsed.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String sfdisk_kernel_geometry (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sfdisk_kernel_geometry: handle is closed");
+ return _sfdisk_kernel_geometry (g, device);
+ }
+ private native String _sfdisk_kernel_geometry (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * display the disk geometry from the partition table
+ * <p>
+ * This displays the disk geometry of "device" read from
+ * the partition table. Especially in the case where the
+ * underlying block device has been resized, this can be
+ * different from the kernel's idea of the geometry (see
+ * "g.sfdisk_kernel_geometry").
+ * <p>
+ * The result is in human-readable format, and not designed
+ * to be parsed.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String sfdisk_disk_geometry (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sfdisk_disk_geometry: handle is closed");
+ return _sfdisk_disk_geometry (g, device);
+ }
+ private native String _sfdisk_disk_geometry (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * activate or deactivate all volume groups
+ * <p>
+ * This command activates or (if "activate" is false)
+ * deactivates all logical volumes in all volume groups. If
+ * activated, then they are made known to the kernel, ie.
+ * they appear as "/dev/mapper" devices. If deactivated,
+ * then those devices disappear.
+ * <p>
+ * This command is the same as running "vgchange -a y|n"
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void vg_activate_all (boolean activate)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("vg_activate_all: handle is closed");
+ _vg_activate_all (g, activate);
+ }
+ private native void _vg_activate_all (long g, boolean activate)
+ throws LibGuestFSException;
+
+ /**
+ * activate or deactivate some volume groups
+ * <p>
+ * This command activates or (if "activate" is false)
+ * deactivates all logical volumes in the listed volume
+ * groups "volgroups". If activated, then they are made
+ * known to the kernel, ie. they appear as "/dev/mapper"
+ * devices. If deactivated, then those devices disappear.
+ * <p>
+ * This command is the same as running "vgchange -a y|n
+ * volgroups..."
+ * <p>
+ * Note that if "volgroups" is an empty list then all
+ * volume groups are activated or deactivated.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void vg_activate (boolean activate, String[] volgroups)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("vg_activate: handle is closed");
+ _vg_activate (g, activate, volgroups);
+ }
+ private native void _vg_activate (long g, boolean activate, String[] volgroups)
+ throws LibGuestFSException;
+
+ /**
+ * resize an LVM logical volume
+ * <p>
+ * This resizes (expands or shrinks) an existing LVM
+ * logical volume to "mbytes". When reducing, data in the
+ * reduced part is lost.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void lvresize (String device, int mbytes)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("lvresize: handle is closed");
+ _lvresize (g, device, mbytes);
+ }
+ private native void _lvresize (long g, String device, int mbytes)
+ throws LibGuestFSException;
+
+ /**
+ * resize an ext2/ext3 filesystem
+ * <p>
+ * This resizes an ext2 or ext3 filesystem to match the
+ * size of the underlying device.
+ * <p>
+ * *Note:* It is sometimes required that you run
+ * "g.e2fsck_f" on the "device" before calling this
+ * command. For unknown reasons "resize2fs" sometimes gives
+ * an error about this and sometimes not. In any case, it
+ * is always safe to call "g.e2fsck_f" before calling this
+ * function.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void resize2fs (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("resize2fs: handle is closed");
+ _resize2fs (g, device);
+ }
+ private native void _resize2fs (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * find all files and directories
+ * <p>
+ * This command lists out all files and directories,
+ * recursively, starting at "directory". It is essentially
+ * equivalent to running the shell command "find directory
+ * -print" but some post-processing happens on the output,
+ * described below.
+ * <p>
+ * This returns a list of strings *without any prefix*.
+ * Thus if the directory structure was:
+ * <p>
+ * /tmp/a
+ * /tmp/b
+ * /tmp/c/d
+ * <p>
+ * then the returned list from "g.find" "/tmp" would be 4
+ * elements:
+ * <p>
+ * a
+ * b
+ * c
+ * c/d
+ * <p>
+ * If "directory" is not a directory, then this command
+ * returns an error.
+ * <p>
+ * The returned list is sorted.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] find (String directory)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("find: handle is closed");
+ return _find (g, directory);
+ }
+ private native String[] _find (long g, String directory)
+ throws LibGuestFSException;
+
+ /**
+ * check an ext2/ext3 filesystem
+ * <p>
+ * This runs "e2fsck -p -f device", ie. runs the ext2/ext3
+ * filesystem checker on "device", noninteractively ("-p"),
+ * even if the filesystem appears to be clean ("-f").
+ * <p>
+ * This command is only needed because of "g.resize2fs"
+ * (q.v.). Normally you should use "g.fsck".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void e2fsck_f (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("e2fsck_f: handle is closed");
+ _e2fsck_f (g, device);
+ }
+ private native void _e2fsck_f (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * sleep for some seconds
+ * <p>
+ * Sleep for "secs" seconds.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void sleep (int secs)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sleep: handle is closed");
+ _sleep (g, secs);
+ }
+ private native void _sleep (long g, int secs)
+ throws LibGuestFSException;
+
+ /**
+ * probe NTFS volume
+ * <p>
+ * This command runs the ntfs-3g.probe(8) command which
+ * probes an NTFS "device" for mountability. (Not all NTFS
+ * volumes can be mounted read-write, and some cannot be
+ * mounted at all).
+ * <p>
+ * "rw" is a boolean flag. Set it to true if you want to
+ * test if the volume can be mounted read-write. Set it to
+ * false if you want to test if the volume can be mounted
+ * read-only.
+ * <p>
+ * The return value is an integer which 0 if the operation
+ * would succeed, or some non-zero value documented in the
+ * ntfs-3g.probe(8) manual page.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int ntfs_3g_probe (boolean rw, String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("ntfs_3g_probe: handle is closed");
+ return _ntfs_3g_probe (g, rw, device);
+ }
+ private native int _ntfs_3g_probe (long g, boolean rw, String device)
+ throws LibGuestFSException;
+
+ /**
+ * run a command via the shell
+ * <p>
+ * This call runs a command from the guest filesystem via
+ * the guest's "/bin/sh".
+ * <p>
+ * This is like "g.command", but passes the command to:
+ * <p>
+ * /bin/sh -c "command"
+ * <p>
+ * Depending on the guest's shell, this usually results in
+ * wildcards being expanded, shell expressions being
+ * interpolated and so on.
+ * <p>
+ * All the provisos about "g.command" apply to this call.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String sh (String command)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sh: handle is closed");
+ return _sh (g, command);
+ }
+ private native String _sh (long g, String command)
+ throws LibGuestFSException;
+
+ /**
+ * run a command via the shell returning lines
+ * <p>
+ * This is the same as "g.sh", but splits the result into a
+ * list of lines.
+ * <p>
+ * See also: "g.command_lines"
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] sh_lines (String command)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("sh_lines: handle is closed");
+ return _sh_lines (g, command);
+ }
+ private native String[] _sh_lines (long g, String command)
+ throws LibGuestFSException;
+
+ /**
+ * expand a wildcard path
+ * <p>
+ * This command searches for all the pathnames matching
+ * "pattern" according to the wildcard expansion rules used
+ * by the shell.
+ * <p>
+ * If no paths match, then this returns an empty list
+ * (note: not an error).
+ * <p>
+ * It is just a wrapper around the C glob(3) function with
+ * flags "GLOB_MARK|GLOB_BRACE". See that manual page for
+ * more details.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] glob_expand (String pattern)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("glob_expand: handle is closed");
+ return _glob_expand (g, pattern);
+ }
+ private native String[] _glob_expand (long g, String pattern)
+ throws LibGuestFSException;
+
+ /**
+ * scrub (securely wipe) a device
+ * <p>
+ * This command writes patterns over "device" to make data
+ * retrieval more difficult.
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * This command is dangerous. Without careful use you can
+ * easily destroy all your data.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_device (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_device: handle is closed");
+ _scrub_device (g, device);
+ }
+ private native void _scrub_device (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * scrub (securely wipe) a file
+ * <p>
+ * This command writes patterns over a file to make data
+ * retrieval more difficult.
+ * <p>
+ * The file is *removed* after scrubbing.
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_file (String file)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_file: handle is closed");
+ _scrub_file (g, file);
+ }
+ private native void _scrub_file (long g, String file)
+ throws LibGuestFSException;
+
+ /**
+ * scrub (securely wipe) free space
+ * <p>
+ * This command creates the directory "dir" and then fills
+ * it with files until the filesystem is full, and scrubs
+ * the files as for "g.scrub_file", and deletes them. The
+ * intention is to scrub any free space on the partition
+ * containing "dir".
+ * <p>
+ * It is an interface to the scrub(1) program. See that
+ * manual page for more details.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void scrub_freespace (String dir)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("scrub_freespace: handle is closed");
+ _scrub_freespace (g, dir);
+ }
+ private native void _scrub_freespace (long g, String dir)
+ throws LibGuestFSException;
+
+ /**
+ * create a temporary directory
+ * <p>
+ * This command creates a temporary directory. The
+ * "template" parameter should be a full pathname for the
+ * temporary directory name with the final six characters
+ * being "XXXXXX".
+ * <p>
+ * For example: "/tmp/myprogXXXXXX" or
+ * "/Temp/myprogXXXXXX", the second one being suitable for
+ * Windows filesystems.
+ * <p>
+ * The name of the temporary directory that was created is
+ * returned.
+ * <p>
+ * The temporary directory is created with mode 0700 and is
+ * owned by root.
+ * <p>
+ * The caller is responsible for deleting the temporary
+ * directory and its contents after use.
+ * <p>
+ * See also: mkdtemp(3)
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String mkdtemp (String template)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mkdtemp: handle is closed");
+ return _mkdtemp (g, template);
+ }
+ private native String _mkdtemp (long g, String template)
+ throws LibGuestFSException;
+
+ /**
+ * count lines in a file
+ * <p>
+ * This command counts the lines in a file, using the "wc
+ * -l" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_l (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_l: handle is closed");
+ return _wc_l (g, path);
+ }
+ private native int _wc_l (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * count words in a file
+ * <p>
+ * This command counts the words in a file, using the "wc
+ * -w" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_w (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_w: handle is closed");
+ return _wc_w (g, path);
+ }
+ private native int _wc_w (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * count characters in a file
+ * <p>
+ * This command counts the characters in a file, using the
+ * "wc -c" external command.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public int wc_c (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("wc_c: handle is closed");
+ return _wc_c (g, path);
+ }
+ private native int _wc_c (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * return first 10 lines of a file
+ * <p>
+ * This command returns up to the first 10 lines of a file
+ * as a list of strings.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] head (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("head: handle is closed");
+ return _head (g, path);
+ }
+ private native String[] _head (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * return first N lines of a file
+ * <p>
+ * If the parameter "nrlines" is a positive number, this
+ * returns the first "nrlines" lines of the file "path".
+ * <p>
+ * If the parameter "nrlines" is a negative number, this
+ * returns lines from the file "path", excluding the last
+ * "nrlines" lines.
+ * <p>
+ * If the parameter "nrlines" is zero, this returns an
+ * empty list.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] head_n (int nrlines, String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("head_n: handle is closed");
+ return _head_n (g, nrlines, path);
+ }
+ private native String[] _head_n (long g, int nrlines, String path)
+ throws LibGuestFSException;
+
+ /**
+ * return last 10 lines of a file
+ * <p>
+ * This command returns up to the last 10 lines of a file
+ * as a list of strings.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] tail (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("tail: handle is closed");
+ return _tail (g, path);
+ }
+ private native String[] _tail (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * return last N lines of a file
+ * <p>
+ * If the parameter "nrlines" is a positive number, this
+ * returns the last "nrlines" lines of the file "path".
+ * <p>
+ * If the parameter "nrlines" is a negative number, this
+ * returns lines from the file "path", starting with the
+ * "-nrlines"th line.
+ * <p>
+ * If the parameter "nrlines" is zero, this returns an
+ * empty list.
+ * <p>
+ * Because of the message protocol, there is a transfer
+ * limit of somewhere between 2MB and 4MB. To transfer
+ * large files you should use FTP.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] tail_n (int nrlines, String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("tail_n: handle is closed");
+ return _tail_n (g, nrlines, path);
+ }
+ private native String[] _tail_n (long g, int nrlines, String path)
+ throws LibGuestFSException;
+
+ /**
+ * report file system disk space usage
+ * <p>
+ * This command runs the "df" command to report disk space
+ * used.
+ * <p>
+ * This command is mostly useful for interactive sessions.
+ * It is *not* intended that you try to parse the output
+ * string. Use "statvfs" from programs.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String df ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("df: handle is closed");
+ return _df (g);
+ }
+ private native String _df (long g)
+ throws LibGuestFSException;
+
+ /**
+ * report file system disk space usage (human readable)
+ * <p>
+ * This command runs the "df -h" command to report disk
+ * space used in human-readable format.
+ * <p>
+ * This command is mostly useful for interactive sessions.
+ * It is *not* intended that you try to parse the output
+ * string. Use "statvfs" from programs.
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String df_h ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("df_h: handle is closed");
+ return _df_h (g);
+ }
+ private native String _df_h (long g)
+ throws LibGuestFSException;
+
+ /**
+ * estimate file space usage
+ * <p>
+ * This command runs the "du -s" command to estimate file
+ * space usage for "path".
+ * <p>
+ * "path" can be a file or a directory. If "path" is a
+ * directory then the estimate includes the contents of the
+ * directory and all subdirectories (recursively).
+ * <p>
+ * The result is the estimated size in *kilobytes* (ie.
+ * units of 1024 bytes).
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public long du (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("du: handle is closed");
+ return _du (g, path);
+ }
+ private native long _du (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * list files in an initrd
+ * <p>
+ * This command lists out files contained in an initrd.
+ * <p>
+ * The files are listed without any initial "/" character.
+ * The files are listed in the order they appear (not
+ * necessarily alphabetical). Directory names are listed as
+ * separate items.
+ * <p>
+ * Old Linux kernels (2.4 and earlier) used a compressed
+ * ext2 filesystem as initrd. We *only* support the newer
+ * initramfs format (compressed cpio files).
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public String[] initrd_list (String path)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("initrd_list: handle is closed");
+ return _initrd_list (g, path);
+ }
+ private native String[] _initrd_list (long g, String path)
+ throws LibGuestFSException;
+
+ /**
+ * mount a file using the loop device
+ * <p>
+ * This command lets you mount "file" (a filesystem image
+ * in a file) on a mount point. It is entirely equivalent
+ * to the command "mount -o loop file mountpoint".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mount_loop (String file, String mountpoint)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mount_loop: handle is closed");
+ _mount_loop (g, file, mountpoint);
+ }
+ private native void _mount_loop (long g, String file, String mountpoint)
+ throws LibGuestFSException;
+
+ /**
+ * create a swap partition
+ * <p>
+ * Create a swap partition on "device".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mkswap (String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mkswap: handle is closed");
+ _mkswap (g, device);
+ }
+ private native void _mkswap (long g, String device)
+ throws LibGuestFSException;
+
+ /**
+ * create a swap partition with a label
+ * <p>
+ * Create a swap partition on "device" with label "label".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mkswap_L (String label, String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mkswap_L: handle is closed");
+ _mkswap_L (g, label, device);
+ }
+ private native void _mkswap_L (long g, String label, String device)
+ throws LibGuestFSException;
+
+ /**
+ * create a swap partition with an explicit UUID
+ * <p>
+ * Create a swap partition on "device" with UUID "uuid".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mkswap_U (String uuid, String device)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mkswap_U: handle is closed");
+ _mkswap_U (g, uuid, device);
+ }
+ private native void _mkswap_U (long g, String uuid, String device)
+ throws LibGuestFSException;
+