From 9ced351034ef5628064a079454a4b1af580f0ac3 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Thu, 30 Mar 2023 12:14:10 +0000 Subject: [PATCH] include: move ALLPERMS definition to compat.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The Windows CI job started to fail as some libcephfs tests that use ALLPERMS have been moved [1] to a separate file which doesn't have the ALLPERMS definition. /ceph/src/test/libcephfs/suidsgid.cc:240:36: error: ‘ALLPERMS’ was not declared in this scope 240 | ASSERT_EQ(stx.stx_mode & (mode_t)ALLPERMS, before_mode); We'll move this definition to compat.h so that we won't have to redefine it in each file that uses it. Note that we're moving the Windows "fs_compat.h" include up, ensuring that the constants used by ALLPERMS are defined. [1] https://github.com/ceph/ceph/commit/254eeb2730881ee48b4743e1422749d5b643f52a Signed-off-by: Lucian Petrut (cherry picked from commit a2966c08171e006acfd9c32b00a1294f428c7e62) --- src/include/compat.h | 10 +++++++++- src/test/libcephfs/test.cc | 4 ---- src/test/libcephfs/vxattr.cc | 4 ---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/include/compat.h b/src/include/compat.h index 4881e01ff98f7..915bd9ac73a74 100644 --- a/src/include/compat.h +++ b/src/include/compat.h @@ -27,10 +27,19 @@ #endif #include + +#ifdef _WIN32 +#include "include/win32/fs_compat.h" +#endif + #ifndef ACCESSPERMS #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) #endif +#ifndef ALLPERMS +#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) +#endif + #if defined(__FreeBSD__) // FreeBSD supports Linux procfs with its compatibility module @@ -232,7 +241,6 @@ int ceph_memzero_s(void *dest, size_t destsz, size_t count); #include #include "include/win32/win32_errno.h" -#include "include/win32/fs_compat.h" // There are a few name collisions between Windows headers and Ceph. // Updating Ceph definitions would be the prefferable fix in order to avoid diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index 8035d2ab44d6b..253442a88447e 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -40,10 +40,6 @@ #include #include -#ifndef ALLPERMS -#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) -#endif - using namespace std; TEST(LibCephFS, OpenEmptyComponent) { diff --git a/src/test/libcephfs/vxattr.cc b/src/test/libcephfs/vxattr.cc index 2a5ad70e4a026..4a67c55d51a1e 100644 --- a/src/test/libcephfs/vxattr.cc +++ b/src/test/libcephfs/vxattr.cc @@ -43,10 +43,6 @@ #include #include -#ifndef ALLPERMS -#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) -#endif - using namespace std; TEST(LibCephFS, LayoutVerifyDefaultLayout) { -- 2.39.5