From b46451d02d2660cdf46338b2e535467bf39e5164 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Mon, 13 Jun 2016 15:55:49 +0530 Subject: Expose glfs_readdirplus_r This patch does the following: * Implements Volume.listdir_with_stat() API which internally invokes glfs_readdirplus_r to return directory entries along with stat for each entry. * Implements Volume.scandir() which is similar to os.scandir() present in Python 3.5 * Makes Dir class iterable. * Enables Dir class to raise OSError when glfs_readdir* calls fail. Previously, these failures were silently being ignored and treated as a case of EOF. Change-Id: Id918c39a7ef3882553e9bcd3fbf9455ee1c25a83 Signed-off-by: Prashanth Pai --- gluster/api.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gluster/api.py') diff --git a/gluster/api.py b/gluster/api.py index e2e2966..c440de6 100755 --- a/gluster/api.py +++ b/gluster/api.py @@ -419,6 +419,12 @@ glfs_readdir_r = gfapi_prototype('glfs_readdir_r', ctypes.c_int, ctypes.POINTER(Dirent), ctypes.POINTER(ctypes.POINTER(Dirent))) +glfs_readdirplus_r = gfapi_prototype('glfs_readdirplus_r', ctypes.c_int, + ctypes.c_void_p, + ctypes.POINTER(Stat), + ctypes.POINTER(Dirent), + ctypes.POINTER(ctypes.POINTER(Dirent))) + glfs_closedir = gfapi_prototype('glfs_closedir', ctypes.c_int, ctypes.c_void_p) -- cgit