From b159587325aaf3a06aaba0b3f205b8c4fa032f26 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 9 May 2016 13:54:46 +0900 Subject: [PATCH] io/romio: fix filesystem type check on OpenBSD 5.7 check the existence of the f_type field in struct statfs Thanks Paul Hargrove for the report --- .../io/romio314/romio/adio/common/ad_fstype.c | 4 ++ ompi/mca/io/romio314/romio/configure.ac | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/ompi/mca/io/romio314/romio/adio/common/ad_fstype.c b/ompi/mca/io/romio314/romio/adio/common/ad_fstype.c index feca9a7ca1..a78f77c952 100644 --- a/ompi/mca/io/romio314/romio/adio/common/ad_fstype.c +++ b/ompi/mca/io/romio314/romio/adio/common/ad_fstype.c @@ -346,6 +346,8 @@ static void ADIO_FileSysType_fncall(const char *filename, int *fstype, int *erro # endif +# ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE + #ifdef ROMIO_GPFS if (fsbuf.f_type == GPFS_SUPER_MAGIC) { *fstype = ADIO_GPFS; @@ -413,6 +415,8 @@ static void ADIO_FileSysType_fncall(const char *filename, int *fstype, int *erro } # endif +# endif /*ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE */ + # ifdef ROMIO_UFS /* if UFS support is enabled, default to that */ *fstype = ADIO_UFS; diff --git a/ompi/mca/io/romio314/romio/configure.ac b/ompi/mca/io/romio314/romio/configure.ac index 7492b816e8..436b7832cb 100644 --- a/ompi/mca/io/romio314/romio/configure.ac +++ b/ompi/mca/io/romio314/romio/configure.ac @@ -1360,11 +1360,53 @@ if test "$pac_cv_have_statfs" = yes ; then AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if struct statfs can be compiled]) fi +AC_MSG_CHECKING([for f_type member of statfs structure]) +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + ],[ + struct statfs f; + memset(&f, 0, sizeof(f)); + f.f_type = 0; + ], + pac_cv_have_statfs_f_type=yes, + pac_cv_have_statfs_f_type=no +) +AC_MSG_RESULT($pac_cv_have_statfs_f_type) +if test $pac_cv_have_statfs_f_type = yes ; then + AC_DEFINE(ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE, 1,[Define if statfs has f_type]) +fi + AC_MSG_CHECKING([for f_fstypename member of statfs structure]) AC_TRY_COMPILE([ +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H #include +#endif +#ifdef HAVE_SYS_MOUNT_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif ],[ struct statfs f; memset(&f, 0, sizeof(f));