From 3b143432910aeb54d4f769b0b061808a9ddfae03 Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Sat, 4 Sep 2021 22:58:45 +0200 Subject: [PATCH] Work around inconsistent type definitions on MIPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The st_rdev field in struct stat (which is 32 bits) is not type dev_t (which is 64 bits) /<>/src/XrdPosix/XrdPosixAdmin.cc:188:45: error: cannot convert ‘long unsigned int*’ to ‘dev_t*’ {aka ‘long long unsigned int*’} 188 | Stat.st_mode = XrdPosixMap::Flags2Mode(&Stat.st_rdev, sInfo->GetFlags()); | ^~~~~~~~~~~~~ | | | long unsigned int* In file included from /<>/src/XrdPosix/XrdPosixAdmin.cc:38: /<>/src/./XrdPosix/XrdPosixMap.hh:43:46: note: initializing argument 1 of ‘static mode_t XrdPosixMap::Flags2Mode(dev_t*, uint32_t)’ 43 | static mode_t Flags2Mode(dev_t *rdv, uint32_t flags); | ~~~~~~~^~~ make[4]: *** [src/CMakeFiles/XrdPosix.dir/build.make:85: src/CMakeFiles/XrdPosix.dir/XrdPosix/XrdPosixAdmin.cc.o] Error 1 --- src/XrdPosix/XrdPosixAdmin.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/XrdPosix/XrdPosixAdmin.cc b/src/XrdPosix/XrdPosixAdmin.cc index bfd1b3d356b..e433329ce72 100644 --- a/src/XrdPosix/XrdPosixAdmin.cc +++ b/src/XrdPosix/XrdPosixAdmin.cc @@ -185,7 +185,16 @@ bool XrdPosixAdmin::Stat(struct stat &Stat) Stat.st_size = static_cast(sInfo->GetSize()); Stat.st_blocks = Stat.st_size/512 + Stat.st_size%512; Stat.st_ino = static_cast(strtoll(sInfo->GetId().c_str(), 0, 10)); +#if defined(__mips__) && _MIPS_SIM == _ABIO32 + // Work around inconsistent type definitions on MIPS + // The st_rdev field in struct stat (which is 32 bits) is not type + // dev_t (which is 64 bits) + dev_t tmp_rdev = Stat.st_rdev; + Stat.st_mode = XrdPosixMap::Flags2Mode(&tmp_rdev, sInfo->GetFlags()); + Stat.st_rdev = tmp_rdev; +#else Stat.st_mode = XrdPosixMap::Flags2Mode(&Stat.st_rdev, sInfo->GetFlags()); +#endif Stat.st_mtime = static_cast(sInfo->GetModTime()); if (sInfo->ExtendedFormat())