cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2-utils: build: Avoid using the kernel versions of kernel headers
@ 2012-11-02 13:57 Andrew Price
  2012-11-02 14:37 ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Price @ 2012-11-02 13:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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() {
 	LIBS=$ac_check_lib_save_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"
-else
-	DEFAULT_KERNEL_DIR="/usr/src/linux"
-fi
-
 # local options
 AC_ARG_ENABLE([debug],
 	[  --enable-debug          enable debug build. ],
@@ -113,13 +103,6 @@ AC_ARG_WITH([sysloglevel],
 	[ SYSLOGLEVEL="$withval" ],
 	[ SYSLOGLEVEL="LOG_INFO" ])
 
-AC_ARG_WITH([kernel],
-	[  --with-kernel=path      path to kernel source. ],
-	[ KERNEL_DIR="$withval" ],
-	[ KERNEL_DIR="$DEFAULT_KERNEL_DIR" ])
-
-KERNEL_CPPFLAGS="-I$KERNEL_DIR/include"
-
 # 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])
 
-BACKUP_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$KERNEL_CPPFLAGS"
-
-# 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_HEADERS([linux/gfs2_ondisk.h],
 		 [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.])])
-
-CPPFLAGS="$BACKUP_CPPFLAGS"
+		 [AC_MSG_ERROR([Unable to find required kernel headers.])])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
@@ -200,7 +171,6 @@ AC_CHECK_FUNCS([ftruncate gettimeofday memset realpath rmdir select setlocale so
 
 LOGDIR=${localstatedir}/log/cluster
 CLUSTERVARRUN=${localstatedir}/run/cluster
-CLUSTERVARLIB=${localstatedir}/lib/cluster
 
 ## do subst
 
@@ -212,8 +182,6 @@ AC_SUBST([CLUSTERVARRUN])
 AC_DEFINE_UNQUOTED([CLUSTERVARRUN], "$(eval echo ${CLUSTERVARRUN})",
 		   [Default cluster var/run directory])
 
-AC_SUBST([CLUSTERVARLIB])
-
 AC_DEFINE_UNQUOTED([SYSLOGFACILITY], $(eval echo ${SYSLOGFACILITY}),
 		   [Default syslog facility])
 
@@ -273,7 +241,7 @@ done
 
 CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS \
 	$EXTRA_WARNINGS $WERROR_CFLAGS"
-CPPFLAGS="$KERNEL_CPPFLAGS -I\$(top_builddir)/make -I\$(top_srcdir)/make \
+CPPFLAGS="-I\$(top_builddir)/make -I\$(top_srcdir)/make \
 	  -I. $ENV_CPPFLAGS"
 LDFLAGS="$ENV_LDFLAGS"
 
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>
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [PATCH] gfs2-utils: build: Avoid using the kernel versions of kernel headers
  2012-11-02 13:57 [Cluster-devel] [PATCH] gfs2-utils: build: Avoid using the kernel versions of kernel headers Andrew Price
@ 2012-11-02 14:37 ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2012-11-02 14:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Looks good to me,

Steve.

On Fri, 2012-11-02 at 13:57 +0000, Andrew Price wrote:
> 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() {
>  	LIBS=$ac_check_lib_save_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"
> -else
> -	DEFAULT_KERNEL_DIR="/usr/src/linux"
> -fi
> -
>  # local options
>  AC_ARG_ENABLE([debug],
>  	[  --enable-debug          enable debug build. ],
> @@ -113,13 +103,6 @@ AC_ARG_WITH([sysloglevel],
>  	[ SYSLOGLEVEL="$withval" ],
>  	[ SYSLOGLEVEL="LOG_INFO" ])
>  
> -AC_ARG_WITH([kernel],
> -	[  --with-kernel=path      path to kernel source. ],
> -	[ KERNEL_DIR="$withval" ],
> -	[ KERNEL_DIR="$DEFAULT_KERNEL_DIR" ])
> -
> -KERNEL_CPPFLAGS="-I$KERNEL_DIR/include"
> -
>  # 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])
>  
> -BACKUP_CPPFLAGS="$CPPFLAGS"
> -CPPFLAGS="$KERNEL_CPPFLAGS"
> -
> -# 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_HEADERS([linux/gfs2_ondisk.h],
>  		 [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.])])
> -
> -CPPFLAGS="$BACKUP_CPPFLAGS"
> +		 [AC_MSG_ERROR([Unable to find required kernel headers.])])
>  
>  # Checks for typedefs, structures, and compiler characteristics.
>  AC_C_INLINE
> @@ -200,7 +171,6 @@ AC_CHECK_FUNCS([ftruncate gettimeofday memset realpath rmdir select setlocale so
>  
>  LOGDIR=${localstatedir}/log/cluster
>  CLUSTERVARRUN=${localstatedir}/run/cluster
> -CLUSTERVARLIB=${localstatedir}/lib/cluster
>  
>  ## do subst
>  
> @@ -212,8 +182,6 @@ AC_SUBST([CLUSTERVARRUN])
>  AC_DEFINE_UNQUOTED([CLUSTERVARRUN], "$(eval echo ${CLUSTERVARRUN})",
>  		   [Default cluster var/run directory])
>  
> -AC_SUBST([CLUSTERVARLIB])
> -
>  AC_DEFINE_UNQUOTED([SYSLOGFACILITY], $(eval echo ${SYSLOGFACILITY}),
>  		   [Default syslog facility])
>  
> @@ -273,7 +241,7 @@ done
>  
>  CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS \
>  	$EXTRA_WARNINGS $WERROR_CFLAGS"
> -CPPFLAGS="$KERNEL_CPPFLAGS -I\$(top_builddir)/make -I\$(top_srcdir)/make \
> +CPPFLAGS="-I\$(top_builddir)/make -I\$(top_srcdir)/make \
>  	  -I. $ENV_CPPFLAGS"
>  LDFLAGS="$ENV_LDFLAGS"
>  
> 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>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-02 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02 13:57 [Cluster-devel] [PATCH] gfs2-utils: build: Avoid using the kernel versions of kernel headers Andrew Price
2012-11-02 14:37 ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).