X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=java%2Fcom%2Fredhat%2Fet%2Flibguestfs%2FGuestFS.java;h=5ae2b106a06cec4d7af9dfe2d8f9d04b1c0030cb;hp=844c3b33e30bca5d643f86698171d46dabbaa7f1;hb=8c3b820c2b687345448e3d74a7101b07ff32688e;hpb=0703248d233744047515418893dac05ce013a642 diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index 844c3b3..5ae2b10 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -2363,12 +2363,21 @@ public class GuestFS { * which should have filesystem type "fstype". * * The returned integer is the status. See fsck(8) for the - * list of status codes from "fsck", and note that multiple - * status codes can be summed together. + * list of status codes from "fsck". * - * It is entirely equivalent to running "fsck -a -t fstype - * device". Note that checking or repairing NTFS volumes is - * not supported (by linux-ntfs). + * Notes: + * + * * Multiple status codes can be summed together. + * + * * A non-zero return code can mean "success", for + * example if errors have been corrected on the + * filesystem. + * + * * Checking or repairing NTFS volumes is not supported + * (by linux-ntfs). + * + * This command is entirely equivalent to running "fsck -a + * -t fstype device". * * @throws LibGuestFSException */ @@ -2382,4 +2391,170 @@ public class GuestFS { private native int _fsck (long g, String fstype, String device) throws LibGuestFSException; + /** + * write zeroes to the device + * + * This command writes zeroes over the first few blocks of + * "device". + * + * 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. + * + * @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 + * + * This command installs GRUB (the Grand Unified + * Bootloader) on "device", with the root directory being + * "root". + * + * @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 + * + * This copies a file from "src" to "dest" where "dest" is + * either a destination filename or destination directory. + * + * @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 + * + * This copies a file or directory from "src" to "dest" + * recursively using the "cp -a" command. + * + * @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 + * + * This moves a file from "src" to "dest" where "dest" is + * either a destination filename or destination directory. + * + * @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 + * + * 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 + * + * Setting "whattodrop" to 3 should drop everything. + * + * This automatically calls sync(2) before the operation, + * so that the maximum guest memory is freed. + * + * @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 + * + * This returns the kernel messages ("dmesg" output) from + * the guest kernel. This is sometimes useful for extended + * debugging of problems. + * + * 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. + * + * @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 + * + * 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. + * + * @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; + }