From 1798832951f0cd3f356a01ead4b7907920e1278f Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 7 Aug 2019 10:35:57 +0530 Subject: [PATCH] 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 --- src/pybind/cephfs/cephfs.pyx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index 40b724f4321..a1a621b6c45 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -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, -- 2.39.5