Open Michael-Hennecke opened 1 month ago
There is already a #if DCOPY_USE_XATTRS
which could be used for this. It's added around the xattr.h
includes, but not all the xattr functions as well.
Similar to what we did for DAOS support
int daos_symlink(const char* oldpath, const char* newpath, mfu_file_t* mfu_file)
{
#ifdef DAOS_SUPPORT
int rc = dfs_sys_symlink(mfu_file->dfs_sys, oldpath, newpath);
return mfu_errno2rc(rc);
#else
return mfu_errno2rc(ENOSYS);
#endif
}
Maybe we can do this for the functions using xattrs
ssize_t mfu_file_llistxattr(const char* path, char* list, size_t size, mfu_file_t* mfu_file)
{
#ifdef DCOPY_USE_XATTRS
if (mfu_file->type == POSIX) {
ssize_t rc = mfu_llistxattr(path, list, size);
return rc;
} else if (mfu_file->type == DFS) {
ssize_t rc = daos_llistxattr(path, list, size, mfu_file);
return rc;
} else {
MFU_ABORT(-1, "File type not known, type=%d",
mfu_file->type);
}
#else
return mfu_errno2rc(ENOSYS);
#endif
}
Or maybe it's better to just not define those at all?
#ifdef DCOPY_USE_XATTRS
ssize_t mfu_file_llistxattr(const char* path, char* list, size_t size, mfu_file_t* mfu_file)
{
if (mfu_file->type == POSIX) {
ssize_t rc = mfu_llistxattr(path, list, size);
return rc;
} else if (mfu_file->type == DFS) {
ssize_t rc = daos_llistxattr(path, list, size, mfu_file);
return rc;
} else {
MFU_ABORT(-1, "File type not known, type=%d",
mfu_file->type);
}
}
#endif
@gonsie Any recommendation for the proper way to handle this?
Sorry, I have no idea. Hopefully @adammoody can help!
@adammoody any comments? it seems that the compiler is actually complaining about not having the declarations for the POSIX functions, independent of DAOS. Adding the headrfile seems to fix the errors:
diff mfu_io.c*
5d4
< #include <sys/xattr.h>
Building on SLES 15.5 and Intel MPI fails with "undeclared function" errors when using -DENABLE_XATTRS=OFF. The respective function calls should probably be wrapped in some sort of "#ifdef XATTR"?
module load gcc intel-toolkit/2024.1.0 intel-mpi/2021.12.0 cmake
cmake ../mpifileutils \ -DCMAKE_INSTALL_PREFIX=../install \ -DWITH_DAOS_PREFIX=/usr \ -DENABLE_DAOS=ON \ -DENABLE_XATTRS=OFF
make -j install ... /dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1509:18: error: call to undeclared function 'llistxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1509 | ssize_t rc = llistxattr(path, list, size); | ^ /dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1546:18: error: call to undeclared function 'listxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1546 | ssize_t rc = listxattr(path, list, size); | ^ /dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1583:18: error: call to undeclared function 'lgetxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1583 | ssize_t rc = lgetxattr(path, name, value, size); | ^ /dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1618:18: error: call to undeclared function 'getxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1618 | ssize_t rc = getxattr(path, name, value, size); | ^ /dss/dsshome1/09/di29puz3/dev/mpifileutils-v0.11.1/mpifileutils/src/common/mfu_io.c:1654:14: error: call to undeclared function 'lsetxattr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1654 | int rc = lsetxattr(path, name, value, size, flags); | ^