From 0c643f8ceac17f8d1dd0ea209b9bbcde1dba9dae Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 3 Jan 2019 19:00:19 +0800 Subject: [PATCH] pybind/rgw: pass the flags to callback function before this change, the `flags` parameter passed to `LibRGWFS.readdir()` will be dropped on the floor and ignored. after this change, it will be passed to the specified callback function. Signed-off-by: Kefu Chai --- PendingReleaseNotes | 3 +++ src/pybind/rgw/rgw.pyx | 6 +++--- src/test/pybind/test_rgwfs.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 415ff783eea..cfca1cd7007 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -154,6 +154,9 @@ * librados::IoCtx::nobjects_begin() and librados::NObjectIterator now communicate errors by throwing a std::system_error exception instead of std::runtime_error. +* the callback function passed to LibRGWFS.readdir() now accepts a ``flags`` + parameter. it will be the last parameter passed to ``readdir()` method. + >=13.1.0 -------- diff --git a/src/pybind/rgw/rgw.pyx b/src/pybind/rgw/rgw.pyx index f512d33f84a..d6eaa75e3d1 100644 --- a/src/pybind/rgw/rgw.pyx +++ b/src/pybind/rgw/rgw.pyx @@ -144,7 +144,7 @@ cdef extern from "rados/rgw_file.h" nogil: int rgw_readdir(rgw_fs *fs, rgw_file_handle *parent_fh, uint64_t *offset, - bool (*cb)(const char *name, void *arg, uint64_t offset) nogil except? -9000, + bool (*cb)(const char *name, void *arg, uint64_t offset, uint32_t flags) nogil except? -9000, void *cb_arg, bool *eof, uint32_t flags) except? -9000 int rgw_getattr(rgw_fs *fs, @@ -314,11 +314,11 @@ cdef make_ex(ret, msg): return Error(msg + (": error code %d" % ret)) -cdef bool readdir_cb(const char *name, void *arg, uint64_t offset) \ +cdef bool readdir_cb(const char *name, void *arg, uint64_t offset, uint32_t flags) \ except? -9000 with gil: if exc.PyErr_Occurred(): return False - (arg)(name, offset) + (arg)(name, offset, flags) return True diff --git a/src/test/pybind/test_rgwfs.py b/src/test/pybind/test_rgwfs.py index c4329662518..06a88d163ad 100644 --- a/src/test/pybind/test_rgwfs.py +++ b/src/test/pybind/test_rgwfs.py @@ -29,7 +29,7 @@ def setup_test(): except Exception: root_dir_handler = rgwfs.mkdir(root_handler, b"bucket", 0) - def cb(name, offset): + def cb(name, offset, flags): names.append(name) rgwfs.readdir(root_dir_handler, cb, 0, 0) for name in names: -- 2.39.5