X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=java%2Fcom%2Fredhat%2Fet%2Flibguestfs%2FGuestFS.java;h=e8f36ff4246a0d13a76efee78d5f08ad19f64c2c;hp=f2901497d102b9ac76e6985597c8c88bf127dfd3;hb=5186251f8f681f2ebb028423bb49a748861fd11e;hpb=5d6b6a3fbbfea19c606b984bac9cf64b6b81cafe diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index f290149..e8f36ff 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -29,6 +29,7 @@ import com.redhat.et.libguestfs.LV; import com.redhat.et.libguestfs.Stat; import com.redhat.et.libguestfs.StatVFS; import com.redhat.et.libguestfs.IntBool; +import com.redhat.et.libguestfs.Dirent; /** * The GuestFS object is a libguestfs handle. @@ -427,7 +428,7 @@ public HashMap test0rhashtableerr () * to modify the image). *

* This is equivalent to the qemu parameter "-drive - * file=filename,cache=off". + * file=filename,cache=off,if=virtio". *

* Note that this call checks for the existence of * "filename". This stops you from specifying other types @@ -488,7 +489,7 @@ public HashMap test0rhashtableerr () * although qemu can support this. *

* This is equivalent to the qemu parameter "-drive - * file=filename,snapshot=on". + * file=filename,snapshot=on,if=virtio". *

* Note that this call checks for the existence of * "filename". This stops you from specifying other types @@ -908,6 +909,57 @@ public HashMap test0rhashtableerr () throws LibGuestFSException; /** + * set memory allocated to the qemu subprocess + *

+ * This sets the memory size in megabytes allocated to the + * qemu subprocess. This only has any effect if called + * before "g.launch". + *

+ * You can also change this by setting the environment + * variable "LIBGUESTFS_MEMSIZE" before the handle is + * created. + *

+ * For more information on the architecture of libguestfs, + * see guestfs(3). + *

+ * @throws LibGuestFSException + */ + public void set_memsize (int memsize) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("set_memsize: handle is closed"); + _set_memsize (g, memsize); + } + private native void _set_memsize (long g, int memsize) + throws LibGuestFSException; + + /** + * get memory allocated to the qemu subprocess + *

+ * This gets the memory size in megabytes allocated to the + * qemu subprocess. + *

+ * If "g.set_memsize" was not called on this handle, and if + * "LIBGUESTFS_MEMSIZE" was not set, then this returns the + * compiled-in default value for memsize. + *

+ * For more information on the architecture of libguestfs, + * see guestfs(3). + *

+ * @throws LibGuestFSException + */ + public int get_memsize () + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("get_memsize: handle is closed"); + return _get_memsize (g); + } + private native int _get_memsize (long g) + throws LibGuestFSException; + + /** * mount a guest disk at a position in the filesystem *

* Mount a guest disk at a position in the filesystem. @@ -3839,4 +3891,194 @@ public HashMap test0rhashtableerr () private native void _mount_loop (long g, String file, String mountpoint) throws LibGuestFSException; + /** + * create a swap partition + *

+ * Create a swap partition on "device". + *

+ * @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 + *

+ * Create a swap partition on "device" with label "label". + *

+ * @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 + *

+ * Create a swap partition on "device" with UUID "uuid". + *

+ * @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; + + /** + * make block, character or FIFO devices + *

+ * This call creates block or character special devices, or + * named pipes (FIFOs). + *

+ * The "mode" parameter should be the mode, using the + * standard constants. "devmajor" and "devminor" are the + * device major and minor numbers, only used when creating + * block and character special devices. + *

+ * @throws LibGuestFSException + */ + public void mknod (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod: handle is closed"); + _mknod (g, mode, devmajor, devminor, path); + } + private native void _mknod (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * make FIFO (named pipe) + *

+ * This call creates a FIFO (named pipe) called "path" with + * mode "mode". It is just a convenient wrapper around + * "g.mknod". + *

+ * @throws LibGuestFSException + */ + public void mkfifo (int mode, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mkfifo: handle is closed"); + _mkfifo (g, mode, path); + } + private native void _mkfifo (long g, int mode, String path) + throws LibGuestFSException; + + /** + * make block device node + *

+ * This call creates a block device node called "path" with + * mode "mode" and device major/minor "devmajor" and + * "devminor". It is just a convenient wrapper around + * "g.mknod". + *

+ * @throws LibGuestFSException + */ + public void mknod_b (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod_b: handle is closed"); + _mknod_b (g, mode, devmajor, devminor, path); + } + private native void _mknod_b (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * make char device node + *

+ * This call creates a char device node called "path" with + * mode "mode" and device major/minor "devmajor" and + * "devminor". It is just a convenient wrapper around + * "g.mknod". + *

+ * @throws LibGuestFSException + */ + public void mknod_c (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod_c: handle is closed"); + _mknod_c (g, mode, devmajor, devminor, path); + } + private native void _mknod_c (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * set file mode creation mask (umask) + *

+ * This function sets the mask used for creating new files + * and device nodes to "mask & 0777". + *

+ * Typical umask values would be 022 which creates new + * files with permissions like "-rw-r--r--" or + * "-rwxr-xr-x", and 002 which creates new files with + * permissions like "-rw-rw-r--" or "-rwxrwxr-x". + *

+ * The default umask is 022. This is important because it + * means that directories and device nodes will be created + * with 0644 or 0755 mode even if you specify 0777. + *

+ * See also umask(2), "g.mknod", "g.mkdir". + *

+ * This call returns the previous umask. + *

+ * @throws LibGuestFSException + */ + public int umask (int mask) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("umask: handle is closed"); + return _umask (g, mask); + } + private native int _umask (long g, int mask) + throws LibGuestFSException; + + /** + * read directories entries + *

+ * This returns the list of directory entries in directory + * "dir". + *

+ * All entries in the directory are returned, including "." + * and "..". The entries are *not* sorted, but returned in + * the same order as the underlying filesystem. + *

+ * This function is primarily intended for use by programs. + * To get a simple list of names, use "g.ls". To get a + * printable directory for human consumption, use "g.ll". + *

+ * @throws LibGuestFSException + */ + public Dirent[] readdir (String dir) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("readdir: handle is closed"); + return _readdir (g, dir); + } + private native Dirent[] _readdir (long g, String dir) + throws LibGuestFSException; + }