Skip to content

Commit 1ee2c37

Browse files
adilgerglennklockwood
authored andcommitted
lustre: fix checks for lustre_user.h header
Fix the configure check if --with-lustre is specified, but the linux/lustre/lustre_user.h header is not present. Only one of the headers needs to be included if both are found. In some cases, FASYNC is not defined, but forms part of the O_LOV_DELAY_CREATE value, add a #define in that case. Fixes #115. Fixes: cb88c4c19a831d94b864c49a162e2635730540e5 Signed-off-by: Andreas Dilger <[email protected]>
1 parent 11469ac commit 1ee2c37

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

configure.ac

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AM_MAINTAINER_MODE
2323

2424
# We can't do anything without a working MPI
2525
AX_PROG_CC_MPI(,,[
26-
AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.])
26+
AC_MSG_FAILURE([MPI compiler requested, but could not use MPI.])
2727
])
2828

2929
AC_PROG_RANLIB
@@ -72,7 +72,9 @@ AC_ARG_WITH([lustre],
7272
[], [with_lustre=check])
7373
AS_IF([test "x$with_lustre" != xno], [
7474
AC_CHECK_HEADERS([linux/lustre/lustre_user.h lustre/lustre_user.h], break, [
75-
if test "x$with_lustre" != xcheck; then
75+
if test "x$with_lustre" != xcheck -a \
76+
"x$ac_cv_header_linux_lustre_lustre_user_h" = "xno" -a \
77+
"x$ac_cv_header_lustre_lustre_user_h" = "xno" ; then
7678
AC_MSG_FAILURE([--with-lustre was given, <lustre/lustre_user.h> not found])
7779
fi
7880
])

src/aiori-POSIX.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
#include <assert.h>
3333

3434

35-
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
36-
# include <lustre/lustre_user.h>
37-
#endif
3835
#ifdef HAVE_LINUX_LUSTRE_LUSTRE_USER_H
3936
# include <linux/lustre/lustre_user.h>
37+
#elif defined(HAVE_LUSTRE_LUSTRE_USER_H)
38+
# include <lustre/lustre_user.h>
4039
#endif
4140
#ifdef HAVE_GPFS_H
4241
# include <gpfs.h>
@@ -278,6 +277,12 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
278277
set_o_direct_flag(&fd_oflag);
279278

280279
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
280+
/* Add a #define for FASYNC if not available, as it forms part of
281+
* the Lustre O_LOV_DELAY_CREATE definition. */
282+
#ifndef FASYNC
283+
#define FASYNC 00020000 /* fcntl, for BSD compatibility */
284+
#endif
285+
281286
if (param->lustre_set_striping) {
282287
/* In the single-shared-file case, task 0 has to creat the
283288
file with the Lustre striping options before any other processes
@@ -298,7 +303,8 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
298303
opts.lmm_stripe_count = param->lustre_stripe_count;
299304

300305
/* File needs to be opened O_EXCL because we cannot set
301-
Lustre striping information on a pre-existing file. */
306+
* Lustre striping information on a pre-existing file.*/
307+
302308
fd_oflag |=
303309
O_CREAT | O_EXCL | O_RDWR | O_LOV_DELAY_CREATE;
304310
*fd = open64(testFileName, fd_oflag, 0664);

0 commit comments

Comments
 (0)