]> git-server-git.apps.pok.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)
committerRishabh Dave <ridave@redhat.com>
Fri, 13 Sep 2019 05:15:46 +0000 (10:45 +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>
src/pybind/cephfs/cephfs.pyx

index 40b724f43214be939296ea32d8ac5862e848a535..a1a621b6c45a95533930eac4147f46a985674643 100644 (file)
@@ -22,6 +22,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
@@ -1111,12 +1112,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')))
@@ -1155,8 +1156,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,