summaryrefslogtreecommitdiffstats
path: root/java/com/redhat/et/libguestfs/GuestFS.java
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-07-01 20:56:58 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-07-02 10:11:55 +0100
commit5186251f8f681f2ebb028423bb49a748861fd11e (patch)
treeb95ea92a8ed1b9443dc04aaf7cdacc8191291bc0 /java/com/redhat/et/libguestfs/GuestFS.java
parentf20854ec61eef1aea313920f0cf193a78c1a9219 (diff)
downloadlibguestfs-5186251f8f681f2ebb028423bb49a748861fd11e.tar.gz
libguestfs-5186251f8f681f2ebb028423bb49a748861fd11e.tar.xz
libguestfs-5186251f8f681f2ebb028423bb49a748861fd11e.zip
Add 'readdir' call.
This adds a readdir call (mostly intended for programs). The return value is a list of guestfs_dirent structures. This adds the new types 'struct guestfs_dirent' and 'struct guestfs_dirent_list', along with all the code to return these in the different language bindings. Also includes additional tests for OCaml and Perl bindings to test this.
Diffstat (limited to 'java/com/redhat/et/libguestfs/GuestFS.java')
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index cc94a987..e8f36ff4 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.
@@ -4054,4 +4055,30 @@ public HashMap<String,String> test0rhashtableerr ()
private native int _umask (long g, int mask)
throws LibGuestFSException;
+ /**
+ * read directories entries
+ * <p>
+ * This returns the list of directory entries in directory
+ * "dir".
+ * <p>
+ * All entries in the directory are returned, including "."
+ * and "..". The entries are *not* sorted, but returned in
+ * the same order as the underlying filesystem.
+ * <p>
+ * 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".
+ * <p>
+ * @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;
+
}