]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/cephfs: define variable for hexcode used in stat()
authorRishabh Dave <ridave@redhat.com>
Wed, 7 Aug 2019 05:05:57 +0000 (10:35 +0530)
committerRamana Raja <rraja@redhat.com>
Mon, 16 Mar 2020 09:48:58 +0000 (15:18 +0530)
Instead of using the same hexcode at multiple locations, define it as a
variable and use the variable instead.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 1798832951f0cd3f356a01ead4b7907920e1278f)

src/pybind/cephfs/cephfs.pyx

index efeeaa0a1cddadb8af0f5fb76423e4c948e8f939..c4b0a290c418780363ba6e3034f6b6786d43fad5 100644 (file)
@@ -23,6 +23,7 @@ else:
     str_type = str
 
 cdef int AT_SYMLINK_NOFOLLOW = 0x100
+cdef int CEPH_STATX_BASIC_STATS = 0x7ffu
 
 cdef extern from "Python.h":
     # These are in cpython/string.pxd, but use "object" types instead of
@@ -1196,12 +1197,12 @@ cdef class LibCephFS(object):
 
         if follow_symlink:
             with nogil:
-                # FIXME: replace magic number with CEPH_STATX_BASIC_STATS
-                ret = ceph_statx(self.cluster, _path, &stx, 0x7ffu, 0)
+                ret = ceph_statx(self.cluster, _path, &stx,
+                                 CEPH_STATX_BASIC_STATS, 0)
         else:
             with nogil:
-                ret = ceph_statx(self.cluster, _path, &stx, 0x7ffu,
-                                 AT_SYMLINK_NOFOLLOW)
+                ret = ceph_statx(self.cluster, _path, &stx,
+                                 CEPH_STATX_BASIC_STATS, AT_SYMLINK_NOFOLLOW)
 
         if ret < 0:
             raise make_ex(ret, "error in stat: {}".format(path.decode('utf-8')))
@@ -1240,8 +1241,8 @@ cdef class LibCephFS(object):
             statx stx
 
         with nogil:
-            # FIXME: replace magic number with CEPH_STATX_BASIC_STATS
-            ret = ceph_fstatx(self.cluster, _fd, &stx, 0x7ffu, 0)
+            ret = ceph_fstatx(self.cluster, _fd, &stx,
+                              CEPH_STATX_BASIC_STATS, 0)
         if ret < 0:
             raise make_ex(ret, "error in fsat")
         return StatResult(st_dev=stx.stx_dev, st_ino=stx.stx_ino,