]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rgw: pass the flags to callback function 25766/head
authorKefu Chai <kchai@redhat.com>
Thu, 3 Jan 2019 11:00:19 +0000 (19:00 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 3 Jan 2019 11:00:28 +0000 (19:00 +0800)
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 <kchai@redhat.com>
PendingReleaseNotes
src/pybind/rgw/rgw.pyx
src/test/pybind/test_rgwfs.py

index 415ff783eeab952b882e23080880517f130b839e..cfca1cd7007c32455b828299a3eb4810d01ec5f3 100644 (file)
 * 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
 --------
 
index f512d33f84ab9ed80f86d5caa64067faf0134192..d6eaa75e3d10968935c9ba64273ae3564f6d6756 100644 (file)
@@ -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
-    (<object>arg)(name, offset)
+    (<object>arg)(name, offset, flags)
     return True
 
 
index c4329662518d5ca7ce3a84b66d5f5d78f51092fd..06a88d163ad5d37520b16afe43bd728f358c301e 100644 (file)
@@ -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: