From: Rishabh Dave Date: Wed, 7 Aug 2019 05:05:57 +0000 (+0530) Subject: pybind/cephfs: define variable for hexcode used in stat() X-Git-Tag: v14.2.10~199^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b59d18b41327297fba3a47b950a7a2ab4cf29fb6;p=ceph.git pybind/cephfs: define variable for hexcode used in stat() Instead of using the same hexcode at multiple locations, define it as a variable and use the variable instead. Signed-off-by: Rishabh Dave (cherry picked from commit 1798832951f0cd3f356a01ead4b7907920e1278f) --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index efeeaa0a1cdda..c4b0a290c4187 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -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,