]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/cephfs: support MacOS
authorKefu Chai <kchai@redhat.com>
Sun, 15 Mar 2020 02:46:04 +0000 (10:46 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 15 Mar 2020 02:56:10 +0000 (10:56 +0800)
like FreeBSD, dentry on MacOS does not have `d_off` field

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/cephfs/cephfs.pyx

index 904ff177481da6b2f5cb6878e4c64475c1662d13..ef092e6243160edad97464209f670226f2a68d30 100644 (file)
@@ -68,7 +68,7 @@ cdef extern from "sys/statvfs.h":
         unsigned long int f_padding[32]
 
 
-IF UNAME_SYSNAME == "FreeBSD":
+IF UNAME_SYSNAME == "FreeBSD" or UNAME_SYSNAME == "Darwin":
     cdef extern from "dirent.h":
         cdef struct dirent:
             long int d_ino
@@ -371,14 +371,14 @@ cdef class DirResult(object):
         if not dirent:
             return None
 
-        IF UNAME_SYSNAME == "FreeBSD":
+        IF UNAME_SYSNAME == "FreeBSD" or UNAME_SYSNAME == "Darwin":
             return DirEntry(d_ino=dirent.d_ino,
                             d_off=0,
                             d_reclen=dirent.d_reclen,
                             d_type=dirent.d_type,
                             d_name=dirent.d_name)
         ELSE:
-             return DirEntry(d_ino=dirent.d_ino,
+            return DirEntry(d_ino=dirent.d_ino,
                             d_off=dirent.d_off,
                             d_reclen=dirent.d_reclen,
                             d_type=dirent.d_type,