summaryrefslogtreecommitdiffstats
path: root/python/guestfs.py
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 /python/guestfs.py
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 'python/guestfs.py')
-rw-r--r--python/guestfs.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/python/guestfs.py b/python/guestfs.py
index ad44df7f..784c5671 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1958,3 +1958,20 @@ class GuestFS:
"""
return libguestfsmod.umask (self._o, mask)
+ def readdir (self, dir):
+ u"""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".
+
+ This function returns a list of directory entries. Each
+ directory entry is represented as a dictionary.
+ """
+ return libguestfsmod.readdir (self._o, dir)
+