Skip to content

Commit

Permalink
kernel configure fix from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Pete Wyckoff committed Mar 11, 2008
1 parent 94d516a commit 5b1c126
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 46 deletions.
40 changes: 20 additions & 20 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -9547,11 +9547,9 @@ echo "${ECHO_T}$gcc_version" >&6; }
fi
fi

tmp_cflags=$CFLAGS
CFLAGS="$CFLAGS -Werror $extra_gcc_flags"
{ echo "$as_me:$LINENO: checking if statfs callbacks' arguments in kernel has struct dentry argument" >&5
echo $ECHO_N "checking if statfs callbacks' arguments in kernel has struct dentry argument... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
{ echo "$as_me:$LINENO: checking for dentry argument in kernel super_operations statfs" >&5
echo $ECHO_N "checking for dentry argument in kernel super_operations statfs... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
Expand All @@ -9560,15 +9558,15 @@ cat >>conftest.$ac_ext <<_ACEOF

#define __KERNEL__
#include <linux/fs.h>
extern int pvfs_statfs(struct dentry *, struct kstatfs *);
static struct super_operations s_op = {
.statfs = pvfs_statfs,
};
int vfs_statfs(struct dentry *de, struct kstatfs *kfs)
{
return 0;
}

int
main ()
{
s_op.statfs = 0;

;
return 0;
}
Expand Down Expand Up @@ -9608,9 +9606,9 @@ fi

rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

{ echo "$as_me:$LINENO: checking if get_sb callback in kernel has struct vfsmount argument" >&5
echo $ECHO_N "checking if get_sb callback in kernel has struct vfsmount argument... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
{ echo "$as_me:$LINENO: checking for vfsmount argument in kernel file_system_type get_sb" >&5
echo $ECHO_N "checking for vfsmount argument in kernel file_system_type get_sb... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
Expand All @@ -9619,16 +9617,19 @@ cat >>conftest.$ac_ext <<_ACEOF

#define __KERNEL__
#include <linux/fs.h>
#include <linux/mount.h>
extern int pvfs_get_sb(struct file_system_type *fst, int flags, const char *devname, void *data, struct vfsmount *);
static struct file_system_type fst = {
.get_sb = pvfs_get_sb,
};
int get_sb_bdev(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *,
int),
struct vfsmount *vfsm)
{
return 0;
}

int
main ()
{
fst.get_sb = 0;

;
return 0;
}
Expand Down Expand Up @@ -9667,7 +9668,6 @@ echo "${ECHO_T}no" >&6; }
fi

rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$tmp_cflags

{ echo "$as_me:$LINENO: checking for xattr support in kernel" >&5
echo $ECHO_N "checking for xattr support in kernel... $ECHO_C" >&6; }
Expand Down
66 changes: 42 additions & 24 deletions maint/config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -426,43 +426,61 @@ AC_DEFUN([AX_KERNEL_FEATURES],
extra_gcc_flags="-Wno-pointer-sign -Wno-strict-aliasing -Wno-strict-aliasing=2"
fi
fi
tmp_cflags=$CFLAGS
CFLAGS="$CFLAGS -Werror $extra_gcc_flags"
dnl if this test passes, there is a struct dentry* argument
AC_MSG_CHECKING(if statfs callbacks' arguments in kernel has struct dentry argument)
dnl if this test passes, the kernel has it
dnl if this test fails, the kernel does not have it
AC_MSG_CHECKING(for dentry argument in kernel super_operations statfs)
dnl Rely on the fact that there is an external vfs_statfs that is
dnl of the same type as the .statfs in struct super_operations to
dnl verify the signature of that function pointer. There is a single
dnl commit in the git history where both changed at the same time
dnl from super_block to dentry.
dnl
dnl The alternative approach of trying to define a s_op.statfs is not
dnl as nice because that only throws a warning, requiring -Werror to
dnl catch it. This is a problem if the compiler happens to spit out
dnl other spurious warnings that have nothing to do with the test.
dnl
dnl If this test passes, the kernel uses a struct dentry argument.
dnl If this test fails, the kernel uses something else (old struct
dnl super_block perhaps).
AC_TRY_COMPILE([
#define __KERNEL__
#include <linux/fs.h>
extern int pvfs_statfs(struct dentry *, struct kstatfs *);
static struct super_operations s_op = {
.statfs = pvfs_statfs,
};
], [ s_op.statfs = 0; ],
int vfs_statfs(struct dentry *de, struct kstatfs *kfs)
{
return 0;
}
], [],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DENTRY_STATFS_SOP, 1, Define if statfs callback has struct dentry argument),
AC_DEFINE(HAVE_DENTRY_STATFS_SOP, 1, Define if super_operations statfs has dentry argument),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(if get_sb callback in kernel has struct vfsmount argument)
dnl if this test passes, the kernel has it
dnl if this test fails, the kernel does not have it
AC_MSG_CHECKING(for vfsmount argument in kernel file_system_type get_sb)
dnl Same trick as above. A single commit changed mayn things at once:
dnl type and signature of file_system_type.get_sb, and signature of
dnl get_sb_bdev. This test is a bit more tenuous, as get_sb_bdev
dnl isn't used directly in a file_system_type, but is a popular helper
dnl for many FSes. And it has not exactly the same signature.
dnl
dnl If this test passes, the kernel has the most modern known form,
dnl which includes a stfuct vfsmount argument.
dnl If this test fails, the kernel uses something else.
AC_TRY_COMPILE([
#define __KERNEL__
#include <linux/fs.h>
#include <linux/mount.h>
extern int pvfs_get_sb(struct file_system_type *fst, int flags, const char *devname, void *data, struct vfsmount *);
static struct file_system_type fst = {
.get_sb = pvfs_get_sb,
};
], [fst.get_sb = 0;],
int get_sb_bdev(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *,
int),
struct vfsmount *vfsm)
{
return 0;
}
], [],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_VFSMOUNT_GETSB, 1, Define if get_sb callback has struct vfsmount argument),
AC_DEFINE(HAVE_VFSMOUNT_GETSB, 1, Define if file_system_type get_sb has vfsmount argument),
AC_MSG_RESULT(no)
)
CFLAGS=$tmp_cflags
AC_MSG_CHECKING(for xattr support in kernel)
dnl if this test passes, the kernel has it
Expand Down
4 changes: 2 additions & 2 deletions pvfs2-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/* Define if DB has get_pagesize function */
#undef HAVE_DB_GET_PAGESIZE

/* Define if statfs callback has struct dentry argument */
/* Define if super_operations statfs has dentry argument */
#undef HAVE_DENTRY_STATFS_SOP

/* Define to 1 if you have the <execinfo.h> header file. */
Expand Down Expand Up @@ -370,7 +370,7 @@
/* Define if include file valgrind.h exists */
#undef HAVE_VALGRIND_H

/* Define if get_sb callback has struct vfsmount argument */
/* Define if file_system_type get_sb has vfsmount argument */
#undef HAVE_VFSMOUNT_GETSB

/* Define if struct file_operations in kernel has writev callback */
Expand Down

0 comments on commit 5b1c126

Please sign in to comment.