[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] gfs2-utils: build: Avoid using the kernel versions of kernel headers

Currently the configure script checks for kernel headers at
/lib/modules/`uname -r`/source/include/linux/* which means we're using
kernel headers not meant to be used in userspace code. Thus we see a lot
of "Attempt to use kernel headers from user space" warnings when
building with a kernel-devel package installed.

Instead we should be using the userspace versions of the headers in
/usr/include/linux/. This patch removes the config options and checks
which pull in the kernel includes and lets the configure script find the
linux headers in the default include path.

Also removes an unnecessary include of kdev_t.h and updates the linux
header checks in configure.ac to only check for the ones we use.

Signed-off-by: Andrew Price <anprice redhat com>
 configure.ac        | 40 ++++------------------------------------
 gfs2/libgfs2/misc.c |  1 -
 2 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef09569..07c6673 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,16 +82,6 @@ check_lib_no_libs() {
-# check kernel headers path
-uname="$(uname -r)"
-if test -d "/lib/modules/$uname/source" -o -L "/lib/modules/$uname/source"; then
-	DEFAULT_KERNEL_DIR="/lib/modules/$uname/source"
-elif test -d "/lib/modules/$uname/build" -o -L "/lib/modules/$uname -r/build"; then
-	DEFAULT_KERNEL_DIR="/lib/modules/$uname/build"
-	DEFAULT_KERNEL_DIR="/usr/src/linux"
 # local options
 	[  --enable-debug          enable debug build. ],
@@ -113,13 +103,6 @@ AC_ARG_WITH([sysloglevel],
 	[ SYSLOGLEVEL="$withval" ],
-	[  --with-kernel=path      path to kernel source. ],
-	[ KERNEL_DIR="$withval" ],
 # gfs_controld isn't required in the latest versions of cluster
 AM_CONDITIONAL([BUILD_GFS_CONTROLD], [test "x$enable_gfs_controld" = "xyes"])
 AS_IF([test "x$enable_gfs_controld" = "xyes"], [
@@ -151,27 +134,15 @@ check_lib_no_libs pthread pthread_mutex_lock
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h mntent.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h sys/time.h sys/vfs.h syslog.h termios.h unistd.h])
-# check kernel headers
-# 2.6.26 adds dlm_plock.h that's our checking barrier, instead
-# of implementing some insane kernel version checks
-AC_CHECK_HEADERS([linux/dlmconstants.h linux/dlm_plock.h linux/kdev_t.h linux/limits.h linux/types.h],,
-		 [AC_MSG_ERROR([Unable to find required kernel headers.
-Make sure to install kernel headers 2.6.26 (or higher) or use --with-kernel=path
-configure option to point to the kernel source.])])
+AC_CHECK_HEADERS([linux/dlmconstants.h linux/limits.h linux/types.h linux/netlink.h linux/fs.h],,
+		 [AC_MSG_ERROR([Unable to find all required kernel headers.])])
 		 [AC_CHECK_MEMBERS([struct gfs2_sb.sb_uuid],,
 			[AC_MSG_ERROR([Unable to find gfs2 uuid support in your headers.
 Please update your kernel headers to a more recent version])],
 			[#include <linux/gfs2_ondisk.h>])],
-		 [AC_MSG_ERROR([Unable to find required kernel headers.
-Make sure to install kernel headers 2.6.26 (or higher) or use --with-kernel=path
-configure option to point to the kernel source.])])
+		 [AC_MSG_ERROR([Unable to find required kernel headers.])])
 # Checks for typedefs, structures, and compiler characteristics.
@@ -200,7 +171,6 @@ AC_CHECK_FUNCS([ftruncate gettimeofday memset realpath rmdir select setlocale so
 ## do subst
@@ -212,8 +182,6 @@ AC_SUBST([CLUSTERVARRUN])
 		   [Default cluster var/run directory])
 		   [Default syslog facility])
@@ -273,7 +241,7 @@ done
-CPPFLAGS="$KERNEL_CPPFLAGS -I\$(top_builddir)/make -I\$(top_srcdir)/make \
+CPPFLAGS="-I\$(top_builddir)/make -I\$(top_srcdir)/make \
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index c2eb245..9efddcd 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -15,7 +15,6 @@
 #include <linux/types.h>
 #include <sys/file.h>
 #include <dirent.h>
-#include <linux/kdev_t.h>
 #include <sys/sysmacros.h>
 #include <mntent.h>
 #include <sys/time.h>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]