From 5b1c126e4198fc8f64e7c7102ac1bc47f22dbcbd Mon Sep 17 00:00:00 2001 From: Pete Wyckoff Date: Tue, 11 Mar 2008 11:35:10 -0400 Subject: [PATCH] kernel configure fix from upstream --- configure | 40 ++++++++++++------------- maint/config/kernel.m4 | 66 +++++++++++++++++++++++++++--------------- pvfs2-config.h.in | 4 +-- 3 files changed, 64 insertions(+), 46 deletions(-) diff --git a/configure b/configure index ad281da..b7200e3 100755 --- a/configure +++ b/configure @@ -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 @@ -9560,15 +9558,15 @@ cat >>conftest.$ac_ext <<_ACEOF #define __KERNEL__ #include - 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; } @@ -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 @@ -9619,16 +9617,19 @@ cat >>conftest.$ac_ext <<_ACEOF #define __KERNEL__ #include - #include - 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; } @@ -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; } diff --git a/maint/config/kernel.m4 b/maint/config/kernel.m4 index 6536b1f..db12f4e 100644 --- a/maint/config/kernel.m4 +++ b/maint/config/kernel.m4 @@ -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 - 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 - #include - 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 diff --git a/pvfs2-config.h.in b/pvfs2-config.h.in index 58e4143..eeb8223 100644 --- a/pvfs2-config.h.in +++ b/pvfs2-config.h.in @@ -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 header file. */ @@ -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 */