2010-05-18 02:18:00 +04:00
|
|
|
###############################################################################
|
|
|
|
# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
|
|
|
|
# Copyright (C) 2007 The Regents of the University of California.
|
|
|
|
# Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
|
|
|
###############################################################################
|
|
|
|
# SPL_AC_CONFIG_KERNEL: Default SPL kernel configuration.
|
|
|
|
###############################################################################
|
|
|
|
|
2009-07-02 01:37:44 +04:00
|
|
|
AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
|
|
|
SPL_AC_KERNEL
|
2011-03-07 21:58:07 +03:00
|
|
|
SPL_AC_KERNEL_CONFIG
|
2009-07-02 01:37:44 +04:00
|
|
|
|
|
|
|
if test "${LINUX_OBJ}" != "${LINUX}"; then
|
|
|
|
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
|
|
|
fi
|
|
|
|
AC_SUBST(KERNELMAKE_PARAMS)
|
2010-09-02 23:12:39 +04:00
|
|
|
|
|
|
|
KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
|
2009-07-02 01:37:44 +04:00
|
|
|
AC_SUBST(KERNELCPPFLAGS)
|
|
|
|
|
|
|
|
SPL_AC_DEBUG
|
|
|
|
SPL_AC_DEBUG_KMEM
|
2009-10-30 23:58:51 +03:00
|
|
|
SPL_AC_DEBUG_KMEM_TRACKING
|
2009-10-30 20:55:25 +03:00
|
|
|
SPL_AC_ATOMIC_SPINLOCK
|
2009-10-30 23:53:17 +03:00
|
|
|
SPL_AC_TYPE_ATOMIC64_CMPXCHG
|
|
|
|
SPL_AC_TYPE_ATOMIC64_XCHG
|
2009-12-05 02:54:12 +03:00
|
|
|
SPL_AC_TYPE_UINTPTR_T
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_3ARGS_INIT_WORK
|
|
|
|
SPL_AC_2ARGS_REGISTER_SYSCTL
|
|
|
|
SPL_AC_SET_SHRINKER
|
2010-10-23 01:16:43 +04:00
|
|
|
SPL_AC_3ARGS_SHRINKER_CALLBACK
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_PATH_IN_NAMEIDATA
|
|
|
|
SPL_AC_TASK_CURR
|
|
|
|
SPL_AC_CTL_UNNUMBERED
|
2010-06-30 21:36:20 +04:00
|
|
|
SPL_AC_CTL_NAME
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_FLS64
|
|
|
|
SPL_AC_DEVICE_CREATE
|
|
|
|
SPL_AC_5ARGS_DEVICE_CREATE
|
|
|
|
SPL_AC_CLASS_DEVICE_CREATE
|
|
|
|
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
|
|
|
|
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
|
|
|
|
SPL_AC_TIMESPEC_SUB
|
|
|
|
SPL_AC_INIT_UTSNAME
|
|
|
|
SPL_AC_FDTABLE_HEADER
|
|
|
|
SPL_AC_FILES_FDTABLE
|
|
|
|
SPL_AC_UACCESS_HEADER
|
|
|
|
SPL_AC_KMALLOC_NODE
|
|
|
|
SPL_AC_MONOTONIC_CLOCK
|
|
|
|
SPL_AC_INODE_I_MUTEX
|
2009-09-26 01:47:01 +04:00
|
|
|
SPL_AC_MUTEX_OWNER
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_MUTEX_LOCK_NESTED
|
|
|
|
SPL_AC_3ARGS_ON_EACH_CPU
|
|
|
|
SPL_AC_KALLSYMS_LOOKUP_NAME
|
|
|
|
SPL_AC_GET_VMALLOC_INFO
|
|
|
|
SPL_AC_PGDAT_HELPERS
|
|
|
|
SPL_AC_FIRST_ONLINE_PGDAT
|
|
|
|
SPL_AC_NEXT_ONLINE_PGDAT
|
|
|
|
SPL_AC_NEXT_ZONE
|
|
|
|
SPL_AC_PGDAT_LIST
|
|
|
|
SPL_AC_GLOBAL_PAGE_STATE
|
2009-07-29 02:06:42 +04:00
|
|
|
SPL_AC_ZONE_STAT_ITEM_FREE
|
|
|
|
SPL_AC_ZONE_STAT_ITEM_INACTIVE
|
|
|
|
SPL_AC_ZONE_STAT_ITEM_ACTIVE
|
|
|
|
SPL_AC_GET_ZONE_COUNTS
|
2010-07-02 00:37:43 +04:00
|
|
|
SPL_AC_USER_PATH_DIR
|
2009-10-02 03:06:15 +04:00
|
|
|
SPL_AC_SET_FS_PWD
|
|
|
|
SPL_AC_2ARGS_SET_FS_PWD
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_2ARGS_VFS_UNLINK
|
|
|
|
SPL_AC_4ARGS_VFS_RENAME
|
2010-11-09 22:15:32 +03:00
|
|
|
SPL_AC_FS_STRUCT_SPINLOCK
|
2009-07-28 04:18:59 +04:00
|
|
|
SPL_AC_CRED_STRUCT
|
|
|
|
SPL_AC_GROUPS_SEARCH
|
2009-09-19 03:09:47 +04:00
|
|
|
SPL_AC_PUT_TASK_STRUCT
|
2010-03-04 23:14:56 +03:00
|
|
|
SPL_AC_5ARGS_PROC_HANDLER
|
2010-06-12 01:48:18 +04:00
|
|
|
SPL_AC_KVASPRINTF
|
2010-07-14 22:26:54 +04:00
|
|
|
SPL_AC_3ARGS_FILE_FSYNC
|
2010-08-10 22:01:46 +04:00
|
|
|
SPL_AC_EXPORTED_RWSEM_IS_LOCKED
|
2011-02-23 23:25:45 +03:00
|
|
|
SPL_AC_KERNEL_INVALIDATE_INODES
|
2011-04-19 00:47:43 +04:00
|
|
|
SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES
|
2011-03-31 04:44:35 +04:00
|
|
|
SPL_AC_SHRINK_DCACHE_MEMORY
|
|
|
|
SPL_AC_SHRINK_ICACHE_MEMORY
|
2011-04-20 23:25:59 +04:00
|
|
|
SPL_AC_KERN_PATH_PARENT
|
2011-04-21 01:22:35 +04:00
|
|
|
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
2009-07-02 01:37:44 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
2009-07-02 21:47:28 +04:00
|
|
|
modpost=$LINUX/scripts/Makefile.modpost
|
2009-07-02 01:37:44 +04:00
|
|
|
AC_MSG_CHECKING([kernel file name for module symbols])
|
2009-07-02 21:47:28 +04:00
|
|
|
if test -f "$modpost"; then
|
|
|
|
if grep -q Modules.symvers $modpost; then
|
|
|
|
LINUX_SYMBOLS=Modules.symvers
|
|
|
|
else
|
|
|
|
LINUX_SYMBOLS=Module.symvers
|
|
|
|
fi
|
2011-03-07 23:59:30 +03:00
|
|
|
|
|
|
|
if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
|
|
|
*** is installed. If your building with a custom kernel make sure the
|
|
|
|
*** kernel is configured, built, and the '--with-linux=PATH' configure
|
|
|
|
*** option refers to the location of the kernel source.])
|
|
|
|
fi
|
2009-07-02 01:37:44 +04:00
|
|
|
else
|
2009-07-02 21:47:28 +04:00
|
|
|
LINUX_SYMBOLS=NONE
|
2009-07-02 01:37:44 +04:00
|
|
|
fi
|
|
|
|
AC_MSG_RESULT($LINUX_SYMBOLS)
|
|
|
|
AC_SUBST(LINUX_SYMBOLS)
|
|
|
|
])
|
|
|
|
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_DEFUN([SPL_AC_KERNEL], [
|
|
|
|
AC_ARG_WITH([linux],
|
|
|
|
AS_HELP_STRING([--with-linux=PATH],
|
|
|
|
[Path to kernel source]),
|
2009-06-16 21:44:59 +04:00
|
|
|
[kernelsrc="$withval"])
|
2008-06-02 21:28:49 +04:00
|
|
|
|
|
|
|
AC_ARG_WITH([linux-obj],
|
|
|
|
AS_HELP_STRING([--with-linux-obj=PATH],
|
|
|
|
[Path to kernel build objects]),
|
|
|
|
[kernelbuild="$withval"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source directory])
|
|
|
|
if test -z "$kernelsrc"; then
|
2011-02-11 01:40:57 +03:00
|
|
|
if test -e "/lib/modules/$(uname -r)/source"; then
|
|
|
|
headersdir="/lib/modules/$(uname -r)/source"
|
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
|
|
|
elif test -e "/lib/modules/$(uname -r)/build"; then
|
|
|
|
headersdir="/lib/modules/$(uname -r)/build"
|
2010-03-09 01:19:30 +03:00
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
|
|
|
else
|
|
|
|
sourcelink=$(ls -1d /usr/src/kernels/* \
|
|
|
|
/usr/src/linux-* \
|
|
|
|
2>/dev/null | grep -v obj | tail -1)
|
|
|
|
fi
|
2008-06-02 21:28:49 +04:00
|
|
|
|
2010-07-02 00:25:34 +04:00
|
|
|
if test -n "$sourcelink" && test -e ${sourcelink}; then
|
2009-03-10 02:50:37 +03:00
|
|
|
kernelsrc=`readlink -f ${sourcelink}`
|
|
|
|
else
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([
|
2010-07-02 00:25:34 +04:00
|
|
|
*** Please make sure the kernel devel package for your distribution
|
|
|
|
*** is installed then try again. If that fails you can specify the
|
|
|
|
*** location of the kernel source with the '--with-linux=PATH' option.])
|
2008-06-02 21:28:49 +04:00
|
|
|
fi
|
2009-03-05 20:08:07 +03:00
|
|
|
else
|
|
|
|
if test "$kernelsrc" = "NONE"; then
|
|
|
|
kernsrcver=NONE
|
|
|
|
fi
|
2008-06-02 21:28:49 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernelsrc])
|
|
|
|
AC_MSG_CHECKING([kernel build directory])
|
2009-06-16 21:44:59 +04:00
|
|
|
if test -z "$kernelbuild"; then
|
2011-02-11 01:40:57 +03:00
|
|
|
if test -e "/lib/modules/$(uname -r)/build"; then
|
|
|
|
kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
|
|
|
|
elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
|
2010-07-02 00:27:30 +04:00
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
|
|
|
|
elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
|
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/default
|
|
|
|
elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
|
|
|
|
kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
|
2009-06-16 21:44:59 +04:00
|
|
|
else
|
|
|
|
kernelbuild=${kernelsrc}
|
|
|
|
fi
|
2009-05-19 22:42:39 +04:00
|
|
|
fi
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_MSG_RESULT([$kernelbuild])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source version])
|
2010-06-30 20:47:57 +04:00
|
|
|
utsrelease1=$kernelbuild/include/linux/version.h
|
|
|
|
utsrelease2=$kernelbuild/include/linux/utsrelease.h
|
|
|
|
utsrelease3=$kernelbuild/include/generated/utsrelease.h
|
|
|
|
if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
|
|
|
|
utsrelease=linux/version.h
|
|
|
|
elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
|
|
|
|
utsrelease=linux/utsrelease.h
|
|
|
|
elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
|
|
|
|
utsrelease=generated/utsrelease.h
|
|
|
|
fi
|
2008-06-02 21:28:49 +04:00
|
|
|
|
2010-06-30 20:47:57 +04:00
|
|
|
if test "$utsrelease"; then
|
|
|
|
kernsrcver=`(echo "#include <$utsrelease>";
|
2008-06-02 21:28:49 +04:00
|
|
|
echo "kernsrcver=UTS_RELEASE") |
|
2009-03-10 02:50:37 +03:00
|
|
|
cpp -I $kernelbuild/include |
|
2008-06-02 21:28:49 +04:00
|
|
|
grep "^kernsrcver=" | cut -d \" -f 2`
|
|
|
|
|
2010-06-30 20:47:57 +04:00
|
|
|
if test -z "$kernsrcver"; then
|
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([*** Cannot determine kernel version.])
|
|
|
|
fi
|
|
|
|
else
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
2010-06-30 20:47:57 +04:00
|
|
|
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
2008-06-02 21:28:49 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernsrcver])
|
|
|
|
|
|
|
|
LINUX=${kernelsrc}
|
|
|
|
LINUX_OBJ=${kernelbuild}
|
2009-03-05 20:08:07 +03:00
|
|
|
LINUX_VERSION=${kernsrcver}
|
|
|
|
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_SUBST(LINUX)
|
|
|
|
AC_SUBST(LINUX_OBJ)
|
2009-03-05 20:08:07 +03:00
|
|
|
AC_SUBST(LINUX_VERSION)
|
2008-06-02 21:28:49 +04:00
|
|
|
|
2009-07-02 01:37:44 +04:00
|
|
|
SPL_AC_MODULE_SYMVERS
|
2009-06-16 22:34:28 +04:00
|
|
|
])
|
|
|
|
|
2011-03-07 21:58:07 +03:00
|
|
|
AC_DEFUN([SPL_AC_KERNEL_CONFIG], [
|
|
|
|
SPL_LINUX_CONFIG([PREEMPT],
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Kernel built with CONFIG_PREEMPT which is not supported.
|
|
|
|
** You must rebuild your kernel without this option.]), [])
|
|
|
|
])
|
|
|
|
|
2009-07-02 01:37:44 +04:00
|
|
|
dnl #
|
2010-07-27 21:19:44 +04:00
|
|
|
dnl # Explicitly check for gawk, we require it for the the usermode
|
|
|
|
dnl # helper. For some reason the standard awk command does not
|
|
|
|
dnl # behave correctly when invoked from the usermode helper.
|
2009-07-02 01:37:44 +04:00
|
|
|
dnl #
|
2010-07-27 21:19:44 +04:00
|
|
|
AC_DEFUN([SPL_AC_GAWK], [
|
2010-07-02 03:20:11 +04:00
|
|
|
AS_IF([test "x$AWK" != xgawk], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Required util gawk missing. Please install the required
|
|
|
|
*** gawk package for your distribution and try again.])
|
|
|
|
])
|
|
|
|
])
|
2009-07-02 01:37:44 +04:00
|
|
|
|
2010-07-27 21:19:44 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Default SPL user configuration
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_CONFIG_USER], [
|
|
|
|
SPL_AC_GAWK
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
|
|
|
|
dnl # are missing it is non-fatal but you will not be able to build
|
|
|
|
dnl # RPM packages and will be warned if you try too.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_RPM], [
|
|
|
|
RPM=rpm
|
|
|
|
RPMBUILD=rpmbuild
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $RPM is available])
|
|
|
|
AS_IF([tmp=$($RPM --version 2>/dev/null)], [
|
|
|
|
RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
|
|
|
|
HAVE_RPM=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_RPM=no
|
|
|
|
AC_MSG_RESULT([$HAVE_RPM])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $RPMBUILD is available])
|
|
|
|
AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
|
|
|
|
RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
|
|
|
|
HAVE_RPMBUILD=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_RPMBUILD=no
|
|
|
|
AC_MSG_RESULT([$HAVE_RPMBUILD])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_RPM)
|
|
|
|
AC_SUBST(RPM)
|
|
|
|
AC_SUBST(RPM_VERSION)
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_RPMBUILD)
|
|
|
|
AC_SUBST(RPMBUILD)
|
|
|
|
AC_SUBST(RPMBUILD_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
|
|
|
|
dnl # tools are missing it is non-fatal but you will not be able to build
|
|
|
|
dnl # DEB packages and will be warned if you try too.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_DPKG], [
|
|
|
|
DPKG=dpkg
|
|
|
|
DPKGBUILD=dpkg-buildpackage
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $DPKG is available])
|
|
|
|
AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
|
|
|
|
DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
|
|
|
|
HAVE_DPKG=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_DPKG=no
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKG])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $DPKGBUILD is available])
|
|
|
|
AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
|
|
|
|
DPKGBUILD_VERSION=$(echo $tmp | \
|
|
|
|
$AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
|
|
|
|
HAVE_DPKGBUILD=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_DPKGBUILD=no
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKGBUILD])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_DPKG)
|
|
|
|
AC_SUBST(DPKG)
|
|
|
|
AC_SUBST(DPKG_VERSION)
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_DPKGBUILD)
|
|
|
|
AC_SUBST(DPKGBUILD)
|
|
|
|
AC_SUBST(DPKGBUILD_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Until native packaging for various different packing systems
|
|
|
|
dnl # can be added the least we can do is attempt to use alien to
|
|
|
|
dnl # convert the RPM packages to the needed package type. This is
|
|
|
|
dnl # a hack but so far it has worked reasonable well.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_ALIEN], [
|
|
|
|
ALIEN=alien
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $ALIEN is available])
|
|
|
|
AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
|
|
|
|
ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
|
|
|
|
HAVE_ALIEN=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_ALIEN=no
|
|
|
|
AC_MSG_RESULT([$HAVE_ALIEN])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_ALIEN)
|
|
|
|
AC_SUBST(ALIEN)
|
|
|
|
AC_SUBST(ALIEN_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Using the VENDOR tag from config.guess set the default
|
|
|
|
dnl # package type for 'make pkg': (rpm | deb | tgz)
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
|
2010-09-03 02:39:08 +04:00
|
|
|
AC_MSG_CHECKING([linux distribution])
|
|
|
|
if test -f /etc/redhat-release ; then
|
|
|
|
VENDOR=redhat ;
|
|
|
|
elif test -f /etc/fedora-release ; then
|
|
|
|
VENDOR=fedora ;
|
|
|
|
elif test -f /etc/lsb-release ; then
|
|
|
|
VENDOR=ubuntu ;
|
|
|
|
elif test -f /etc/debian_version ; then
|
|
|
|
VENDOR=debian ;
|
|
|
|
elif test -f /etc/SuSE-release ; then
|
|
|
|
VENDOR=sles ;
|
|
|
|
elif test -f /etc/slackware-version ; then
|
|
|
|
VENDOR=slackware ;
|
|
|
|
elif test -f /etc/gentoo-release ; then
|
|
|
|
VENDOR=gentoo ;
|
|
|
|
else
|
|
|
|
VENDOR= ;
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$VENDOR])
|
|
|
|
AC_SUBST(VENDOR)
|
2010-07-27 21:19:44 +04:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([default package type])
|
|
|
|
case "$VENDOR" in
|
|
|
|
fedora) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
redhat) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
sles) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
ubuntu) DEFAULT_PACKAGE=deb ;;
|
|
|
|
debian) DEFAULT_PACKAGE=deb ;;
|
|
|
|
slackware) DEFAULT_PACKAGE=tgz ;;
|
|
|
|
*) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$DEFAULT_PACKAGE])
|
|
|
|
AC_SUBST(DEFAULT_PACKAGE)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Default SPL user configuration
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_PACKAGE], [
|
|
|
|
SPL_AC_RPM
|
|
|
|
SPL_AC_DPKG
|
|
|
|
SPL_AC_ALIEN
|
|
|
|
SPL_AC_DEFAULT_PACKAGE
|
|
|
|
])
|
|
|
|
|
2008-11-14 00:43:30 +03:00
|
|
|
AC_DEFUN([SPL_AC_LICENSE], [
|
2009-07-02 01:37:44 +04:00
|
|
|
AC_MSG_CHECKING([spl license])
|
|
|
|
LICENSE=GPL
|
|
|
|
AC_MSG_RESULT([$LICENSE])
|
2008-11-14 00:43:30 +03:00
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
|
2009-07-02 01:37:44 +04:00
|
|
|
AC_SUBST(LICENSE)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([SPL_AC_CONFIG], [
|
|
|
|
SPL_CONFIG=all
|
|
|
|
AC_ARG_WITH([config],
|
|
|
|
AS_HELP_STRING([--with-config=CONFIG],
|
2009-11-25 01:21:45 +03:00
|
|
|
[Config file 'kernel|user|all|srpm']),
|
2009-07-02 01:37:44 +04:00
|
|
|
[SPL_CONFIG="$withval"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([spl config])
|
|
|
|
AC_MSG_RESULT([$SPL_CONFIG]);
|
|
|
|
AC_SUBST(SPL_CONFIG)
|
|
|
|
|
|
|
|
case "$SPL_CONFIG" in
|
|
|
|
kernel) SPL_AC_CONFIG_KERNEL ;;
|
|
|
|
user) SPL_AC_CONFIG_USER ;;
|
|
|
|
all) SPL_AC_CONFIG_KERNEL
|
|
|
|
SPL_AC_CONFIG_USER ;;
|
2009-11-25 01:21:45 +03:00
|
|
|
srpm) ;;
|
2009-07-02 01:37:44 +04:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([Error!])
|
|
|
|
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
|
2009-11-25 01:21:45 +03:00
|
|
|
user kernel|user|all|srpm]) ;;
|
2009-07-02 01:37:44 +04:00
|
|
|
esac
|
|
|
|
|
|
|
|
AM_CONDITIONAL([CONFIG_USER],
|
|
|
|
[test "$SPL_CONFIG" = user] ||
|
|
|
|
[test "$SPL_CONFIG" = all])
|
|
|
|
AM_CONDITIONAL([CONFIG_KERNEL],
|
|
|
|
[test "$SPL_CONFIG" = kernel] ||
|
|
|
|
[test "$SPL_CONFIG" = all])
|
2008-11-14 00:43:30 +03:00
|
|
|
])
|
|
|
|
|
2009-10-30 23:58:51 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Enable if the SPL should be compiled with internal debugging enabled.
|
|
|
|
dnl # By default this support is disabled.
|
|
|
|
dnl #
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_DEFUN([SPL_AC_DEBUG], [
|
2010-07-01 04:05:36 +04:00
|
|
|
AC_MSG_CHECKING([whether debugging is enabled])
|
2009-10-30 23:58:51 +03:00
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
[AS_HELP_STRING([--enable-debug],
|
|
|
|
[Enable generic debug support @<:@default=no@:>@])],
|
|
|
|
[],
|
|
|
|
[enable_debug=no])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_debug" = xyes],
|
2010-07-01 04:05:36 +04:00
|
|
|
[
|
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
|
|
|
|
DEBUG_CFLAGS="-DDEBUG -Werror"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
|
|
|
|
DEBUG_CFLAGS="-DNDEBUG"
|
|
|
|
])
|
2009-10-30 23:58:51 +03:00
|
|
|
|
2010-07-01 04:05:36 +04:00
|
|
|
AC_SUBST(DEBUG_CFLAGS)
|
2009-10-30 23:58:51 +03:00
|
|
|
AC_MSG_RESULT([$enable_debug])
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
|
2009-10-30 23:58:51 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Enabled by default it provides a minimal level of memory tracking.
|
|
|
|
dnl # A total count of bytes allocated is kept for each alloc and free.
|
|
|
|
dnl # Then at module unload time a report to the console will be printed
|
|
|
|
dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
|
|
|
|
dnl # and provide an easy way to inspect the kmem based slab.
|
|
|
|
dnl #
|
2008-06-02 21:28:49 +04:00
|
|
|
AC_DEFUN([SPL_AC_DEBUG_KMEM], [
|
2009-10-30 23:58:51 +03:00
|
|
|
AC_ARG_ENABLE([debug-kmem],
|
|
|
|
[AS_HELP_STRING([--enable-debug-kmem],
|
|
|
|
[Enable basic kmem accounting @<:@default=yes@:>@])],
|
|
|
|
[],
|
|
|
|
[enable_debug_kmem=yes])
|
2008-06-02 21:28:49 +04:00
|
|
|
|
2009-10-30 23:58:51 +03:00
|
|
|
AS_IF([test "x$enable_debug_kmem" = xyes],
|
|
|
|
[AC_DEFINE([DEBUG_KMEM], [1],
|
|
|
|
[Define to 1 to enable basic kmem accounting])
|
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether basic kmem accounting is enabled])
|
|
|
|
AC_MSG_RESULT([$enable_debug_kmem])
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
|
2009-10-30 23:58:51 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Disabled by default it provides detailed memory tracking. This
|
|
|
|
dnl # feature also requires --enable-debug-kmem to be set. When enabled
|
|
|
|
dnl # not only will total bytes be tracked but also the location of every
|
|
|
|
dnl # alloc and free. When the SPL module is unloaded a list of all leaked
|
|
|
|
dnl # addresses and where they were allocated will be dumped to the console.
|
|
|
|
dnl # Enabling this feature has a significant impact on performance but it
|
|
|
|
dnl # makes finding memory leaks pretty straight forward.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
|
|
|
|
AC_ARG_ENABLE([debug-kmem-tracking],
|
|
|
|
[AS_HELP_STRING([--enable-debug-kmem-tracking],
|
|
|
|
[Enable detailed kmem tracking @<:@default=no@:>@])],
|
|
|
|
[],
|
|
|
|
[enable_debug_kmem_tracking=no])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
|
|
|
|
[AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
|
|
|
|
[Define to 1 to enable detailed kmem tracking])
|
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
|
|
|
|
AC_MSG_RESULT([$enable_debug_kmem_tracking])
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_LINUX_CONFTEST
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_LINUX_CONFTEST], [
|
2010-07-01 12:39:32 +04:00
|
|
|
cat confdefs.h - <<_ACEOF >conftest.c
|
2008-06-02 21:28:49 +04:00
|
|
|
$1
|
|
|
|
_ACEOF
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
|
|
|
|
dnl #
|
|
|
|
m4_define([SPL_LANG_PROGRAM], [
|
|
|
|
$1
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
dnl Do *not* indent the following line: there may be CPP directives.
|
|
|
|
dnl Don't move the `;' right after for the same reason.
|
|
|
|
$2
|
|
|
|
;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
|
2009-03-05 20:08:07 +03:00
|
|
|
m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
|
|
|
|
rm -Rf build && mkdir -p build
|
|
|
|
echo "obj-m := conftest.o" >build/Makefile
|
|
|
|
AS_IF(
|
2009-07-27 20:52:01 +04:00
|
|
|
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
2009-03-05 20:08:07 +03:00
|
|
|
[$4],
|
|
|
|
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
|
|
|
|
)
|
|
|
|
rm -Rf build
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_LINUX_TRY_COMPILE],
|
|
|
|
[SPL_LINUX_COMPILE_IFELSE(
|
2008-11-03 22:53:23 +03:00
|
|
|
[AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
|
|
|
|
[modules],
|
|
|
|
[test -s build/conftest.o],
|
|
|
|
[$3], [$4])
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_LINUX_CONFIG
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_LINUX_CONFIG],
|
|
|
|
[AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#ifndef AUTOCONF_INCLUDED
|
|
|
|
#include <linux/config.h>
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
#ifndef CONFIG_$1
|
|
|
|
#error CONFIG_$1 not #defined
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$2
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SPL_CHECK_SYMBOL_EXPORT
|
|
|
|
dnl # check symbol exported or not
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
|
|
|
|
[AC_MSG_CHECKING([whether symbol $1 is exported])
|
2009-06-16 22:34:28 +04:00
|
|
|
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
|
|
|
$LINUX_OBJ/Module*.symvers 2>/dev/null
|
2008-06-02 21:28:49 +04:00
|
|
|
rc=$?
|
|
|
|
if test $rc -ne 0; then
|
|
|
|
export=0
|
|
|
|
for file in $2; do
|
2009-06-16 22:34:28 +04:00
|
|
|
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
|
|
|
"$LINUX_OBJ/$file" 2>/dev/null
|
2008-06-02 21:28:49 +04:00
|
|
|
rc=$?
|
|
|
|
if test $rc -eq 0; then
|
|
|
|
export=1
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if test $export -eq 0; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
$4
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2008-08-11 21:56:40 +04:00
|
|
|
dnl #
|
|
|
|
dnl # SPL_CHECK_HEADER
|
|
|
|
dnl # check whether header exists and define HAVE_$2_HEADER
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_CHECK_HEADER],
|
|
|
|
[AC_MSG_CHECKING([whether header $1 exists])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2008-11-03 22:53:23 +03:00
|
|
|
#include <$1>
|
2008-08-11 21:56:40 +04:00
|
|
|
],[
|
|
|
|
return 0;
|
|
|
|
],[
|
|
|
|
AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
$4
|
|
|
|
])
|
|
|
|
])
|
2008-08-11 21:20:11 +04:00
|
|
|
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl #
|
2009-12-05 02:54:12 +03:00
|
|
|
dnl # Use the atomic implemenation based on global spinlocks. This
|
|
|
|
dnl # should only be needed by 32-bit kernels which do not provide
|
|
|
|
dnl # the atomic64_* API. It may be optionally enabled as a fallback
|
|
|
|
dnl # if problems are observed with the direct mapping to the native
|
|
|
|
dnl # Linux atomic operations. You may not disable atomic spinlocks
|
|
|
|
dnl # if you kernel does not an atomic64_* API.
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl #
|
2009-12-05 02:54:12 +03:00
|
|
|
AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
|
|
|
|
AC_ARG_ENABLE([atomic-spinlocks],
|
|
|
|
[AS_HELP_STRING([--enable-atomic-spinlocks],
|
|
|
|
[Atomic types use spinlocks @<:@default=check@:>@])],
|
|
|
|
[],
|
|
|
|
[enable_atomic_spinlocks=check])
|
2008-06-02 21:28:49 +04:00
|
|
|
|
2008-11-04 00:06:04 +03:00
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <asm/atomic.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
atomic64_t *ptr __attribute__ ((unused));
|
2008-11-04 00:06:04 +03:00
|
|
|
],[
|
2009-12-05 02:54:12 +03:00
|
|
|
have_atomic64_t=yes
|
2008-11-04 00:06:04 +03:00
|
|
|
AC_DEFINE(HAVE_ATOMIC64_T, 1,
|
2009-12-05 02:54:12 +03:00
|
|
|
[kernel defines atomic64_t])
|
2008-11-04 00:06:04 +03:00
|
|
|
],[
|
2009-12-05 02:54:12 +03:00
|
|
|
have_atomic64_t=no
|
|
|
|
])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
|
|
|
|
AS_IF([test "x$have_atomic64_t" = xyes], [
|
|
|
|
enable_atomic_spinlocks=no
|
|
|
|
],[
|
|
|
|
enable_atomic_spinlocks=yes
|
|
|
|
])
|
2008-11-04 00:06:04 +03:00
|
|
|
])
|
2009-12-05 02:54:12 +03:00
|
|
|
|
|
|
|
AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
|
|
|
|
AC_DEFINE([ATOMIC_SPINLOCK], [1],
|
|
|
|
[Atomic types use spinlocks])
|
|
|
|
],[
|
|
|
|
AS_IF([test "x$have_atomic64_t" = xno], [
|
|
|
|
AC_MSG_FAILURE(
|
|
|
|
[--disable-atomic-spinlocks given but required atomic64 support is unavailable])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether atomic types use spinlocks])
|
|
|
|
AC_MSG_RESULT([$enable_atomic_spinlocks])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether kernel defines atomic64_t])
|
|
|
|
AC_MSG_RESULT([$have_atomic64_t])
|
2008-11-04 00:06:04 +03:00
|
|
|
])
|
|
|
|
|
2009-10-30 23:53:17 +03:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.24 API change,
|
|
|
|
dnl # check if atomic64_cmpxchg is defined
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
|
|
|
|
[AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <asm/atomic.h>
|
2010-08-07 01:04:00 +04:00
|
|
|
#include <asm/system.h>
|
2009-10-30 23:53:17 +03:00
|
|
|
],[
|
|
|
|
atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
|
|
|
|
[kernel defines atomic64_cmpxchg])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.24 API change,
|
|
|
|
dnl # check if atomic64_xchg is defined
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
|
|
|
|
[AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <asm/atomic.h>
|
|
|
|
],[
|
|
|
|
atomic64_xchg((atomic64_t *)NULL, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
|
|
|
|
[kernel defines atomic64_xchg])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-12-05 02:54:12 +03:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.24 API change,
|
|
|
|
dnl # check if uintptr_t typedef is defined
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
|
|
|
|
[AC_MSG_CHECKING([whether kernel defines uintptr_t])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/types.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
uintptr_t *ptr __attribute__ ((unused));
|
2009-12-05 02:54:12 +03:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_UINTPTR_T, 1,
|
|
|
|
[kernel defines uintptr_t])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.20 API change,
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl # INIT_WORK use 2 args and not store data inside
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
|
|
|
|
[AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2008-11-03 22:53:23 +03:00
|
|
|
#include <linux/workqueue.h>
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct work_struct work __attribute__ ((unused));
|
2008-11-03 22:53:23 +03:00
|
|
|
INIT_WORK(&work, NULL, NULL);
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
|
|
|
|
[INIT_WORK wants 3 args])
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(no)
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.21 API change,
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl # 'register_sysctl_table' use only one argument instead of two
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
|
|
|
|
[AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2008-11-03 22:53:23 +03:00
|
|
|
#include <linux/sysctl.h>
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
(void) register_sysctl_table(NULL, 0);
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
|
|
|
|
[register_sysctl_table() wants 2 args])
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(no)
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.23 API change
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl # Old set_shrinker API replaced with register_shrinker
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_SET_SHRINKER], [
|
|
|
|
AC_MSG_CHECKING([whether set_shrinker() available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
|
|
|
return set_shrinker(DEFAULT_SEEKS, NULL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_SET_SHRINKER, 1,
|
|
|
|
[set_shrinker() available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2010-10-23 01:16:43 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.35 API change,
|
|
|
|
dnl # Add context to shrinker callback
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK],
|
|
|
|
[AC_MSG_CHECKING([whether shrinker callback wants 3 args])
|
|
|
|
tmp_flags="$EXTRA_KCFLAGS"
|
|
|
|
EXTRA_KCFLAGS="-Werror"
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
|
|
|
|
int shrinker_cb(struct shrinker *, int, unsigned int);
|
|
|
|
],[
|
|
|
|
struct shrinker cache_shrinker = {
|
|
|
|
.shrink = shrinker_cb,
|
|
|
|
.seeks = DEFAULT_SEEKS,
|
|
|
|
};
|
|
|
|
register_shrinker(&cache_shrinker);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
|
|
|
|
[shrinker callback wants 3 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
EXTRA_KCFLAGS="$tmp_flags"
|
|
|
|
])
|
|
|
|
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.25 API change,
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl # struct path entry added to struct nameidata
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
|
|
|
|
[AC_MSG_CHECKING([whether struct path used in struct nameidata])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2008-11-03 22:53:23 +03:00
|
|
|
#include <linux/namei.h>
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct nameidata nd __attribute__ ((unused));
|
2008-06-02 21:28:49 +04:00
|
|
|
|
|
|
|
nd.path.mnt = NULL;
|
|
|
|
nd.path.dentry = NULL;
|
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
|
|
|
|
[struct path used in struct nameidata])
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(no)
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Custom SPL patch may export this system it is not required
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_TASK_CURR], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
|
|
|
|
[AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.19 API change,
|
2008-06-02 21:28:49 +04:00
|
|
|
dnl # Use CTL_UNNUMBERED when binary sysctl is not required
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
|
|
|
|
[AC_MSG_CHECKING([whether unnumbered sysctl support exists])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2008-11-03 22:53:23 +03:00
|
|
|
#include <linux/sysctl.h>
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
|
|
|
#ifndef CTL_UNNUMBERED
|
|
|
|
#error CTL_UNNUMBERED undefined
|
|
|
|
#endif
|
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
|
|
|
|
[unnumbered sysctl support exists])
|
2008-06-02 21:28:49 +04:00
|
|
|
],[
|
2008-11-03 22:53:23 +03:00
|
|
|
AC_MSG_RESULT(no)
|
2008-06-02 21:28:49 +04:00
|
|
|
])
|
|
|
|
])
|
2008-08-06 08:52:39 +04:00
|
|
|
|
2010-06-30 21:36:20 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.33 API change,
|
|
|
|
dnl # Removed .ctl_name from struct ctl_table.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_CTL_NAME], [
|
|
|
|
AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/sysctl.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct ctl_table ctl __attribute__ ((unused));
|
2010-06-30 21:36:20 +04:00
|
|
|
ctl.ctl_name = 0;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2008-08-06 08:52:39 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.16 API change.
|
|
|
|
dnl # Check if 'fls64()' is available
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_FLS64],
|
2008-08-11 21:20:11 +04:00
|
|
|
[AC_MSG_CHECKING([whether fls64() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
],[
|
|
|
|
return fls64(0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
2008-08-06 08:52:39 +04:00
|
|
|
])
|
2008-08-10 07:50:36 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.18 API change, check whether device_create() is available.
|
|
|
|
dnl # Device_create() was introduced in 2.6.18 and depricated
|
|
|
|
dnl # class_device_create() which was fully removed in 2.6.26.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_DEVICE_CREATE], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[device_create],
|
|
|
|
[drivers/base/core.c],
|
|
|
|
[AC_DEFINE(HAVE_DEVICE_CREATE, 1,
|
|
|
|
[device_create() is available])],
|
2008-08-11 21:20:11 +04:00
|
|
|
[])
|
2008-08-10 07:50:36 +04:00
|
|
|
])
|
|
|
|
|
2009-03-13 23:38:43 +03:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.27 API change,
|
|
|
|
dnl # device_create() uses 5 args, new 'drvdata' argument.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
|
|
|
|
AC_MSG_CHECKING([whether device_create() wants 5 args])
|
|
|
|
tmp_flags="$EXTRA_KCFLAGS"
|
|
|
|
EXTRA_KCFLAGS="-Werror"
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/device.h>
|
|
|
|
],[
|
|
|
|
device_create(NULL, NULL, 0, NULL, "%d", 1);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
|
|
|
|
[device_create wants 5 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
EXTRA_KCFLAGS="$tmp_flags"
|
|
|
|
])
|
|
|
|
|
2008-08-10 07:50:36 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.13 API change, check whether class_device_create() is available.
|
|
|
|
dnl # Class_device_create() was introduced in 2.6.13 and depricated
|
|
|
|
dnl # class_simple_device_add() which was fully removed in 2.6.13.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[class_device_create],
|
|
|
|
[drivers/base/class.c],
|
|
|
|
[AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
|
|
|
|
[class_device_create() is available])],
|
2008-08-11 21:20:11 +04:00
|
|
|
[])
|
2008-08-10 07:50:36 +04:00
|
|
|
])
|
2008-08-11 21:20:11 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[set_normalized_timespec],
|
|
|
|
[kernel/time.c],
|
|
|
|
[AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
|
|
|
|
[set_normalized_timespec() is available as export])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
|
|
|
|
dnl # previously it was available in time.h as an inline.
|
|
|
|
dnl #
|
2008-08-11 21:56:40 +04:00
|
|
|
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
|
|
|
|
AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
|
2008-08-11 21:20:11 +04:00
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/time.h>
|
|
|
|
void set_normalized_timespec(struct timespec *ts,
|
2008-08-12 03:47:44 +04:00
|
|
|
time_t sec, long nsec) { }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[
|
2008-08-11 21:20:11 +04:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
|
|
|
|
[set_normalized_timespec() is available as inline])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.18 API change,
|
|
|
|
dnl # timespec_sub() inline function available in linux/time.h
|
|
|
|
dnl #
|
2008-08-11 21:56:40 +04:00
|
|
|
AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
|
|
|
|
AC_MSG_CHECKING([whether timespec_sub() is available])
|
2008-08-11 21:20:11 +04:00
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/time.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct timespec a = { 0 };
|
|
|
|
struct timespec b = { 0 };
|
|
|
|
struct timespec c __attribute__ ((unused));
|
2008-08-11 21:20:11 +04:00
|
|
|
c = timespec_sub(a, b);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2008-08-11 21:56:40 +04:00
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.19 API change,
|
|
|
|
dnl # check if init_utsname() is available in linux/utsname.h
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_INIT_UTSNAME], [
|
|
|
|
AC_MSG_CHECKING([whether init_utsname() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/utsname.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct new_utsname *a __attribute__ ((unused));
|
|
|
|
a = init_utsname();
|
2008-08-12 02:13:47 +04:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.26 API change,
|
|
|
|
dnl # definition of struct fdtable relocated to linux/fdtable.h
|
2008-08-11 21:56:40 +04:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
|
|
|
|
SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
|
|
|
|
])
|
2008-08-11 23:10:14 +04:00
|
|
|
|
|
|
|
dnl #
|
2008-08-12 02:13:47 +04:00
|
|
|
dnl # 2.6.14 API change,
|
|
|
|
dnl # check whether 'files_fdtable()' exists
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_FILES_FDTABLE], [
|
|
|
|
AC_MSG_CHECKING([whether files_fdtable() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#ifdef HAVE_FDTABLE_HEADER
|
|
|
|
#include <linux/fdtable.h>
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
struct files_struct *files = current->files;
|
2011-04-19 20:26:48 +04:00
|
|
|
struct fdtable *fdt __attribute__ ((unused));
|
|
|
|
fdt = files_fdtable(files);
|
2008-08-12 02:13:47 +04:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.18 API change,
|
|
|
|
dnl # added linux/uaccess.h
|
2008-08-11 23:10:14 +04:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_UACCESS_HEADER], [
|
|
|
|
SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
|
|
|
|
])
|
2008-08-12 02:13:47 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.12 API change,
|
|
|
|
dnl # check whether 'kmalloc_node()' is available.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KMALLOC_NODE], [
|
|
|
|
AC_MSG_CHECKING([whether kmalloc_node() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/slab.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
void *a __attribute__ ((unused));
|
|
|
|
a = kmalloc_node(1, GFP_KERNEL, 0);
|
2008-08-12 02:13:47 +04:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.9 API change,
|
|
|
|
dnl # check whether 'monotonic_clock()' is available it may
|
|
|
|
dnl # be available for some archs but not others.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[monotonic_clock],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
|
|
|
|
[monotonic_clock() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.16 API change,
|
|
|
|
dnl # check whether 'struct inode' has i_mutex
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
|
|
|
|
AC_MSG_CHECKING([whether struct inode has i_mutex])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
],[
|
|
|
|
struct inode i;
|
|
|
|
mutex_init(&i.i_mutex);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2008-08-12 02:42:04 +04:00
|
|
|
|
2009-09-26 01:47:01 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.29 API change,
|
|
|
|
dnl # Adaptive mutexs introduced.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_MUTEX_OWNER], [
|
|
|
|
AC_MSG_CHECKING([whether struct mutex has owner])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct mutex mtx __attribute__ ((unused));
|
2009-09-26 01:47:01 +04:00
|
|
|
mtx.owner = NULL;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-05-20 21:56:13 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.18 API change,
|
|
|
|
dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
|
|
|
|
dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
|
|
|
|
dnl # if the mutex validator is disabled or otherwise unavailable.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
|
|
|
|
AC_MSG_CHECKING([whether mutex_lock_nested() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
],[
|
|
|
|
struct mutex mutex;
|
|
|
|
mutex_init(&mutex);
|
|
|
|
mutex_lock_nested(&mutex, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
|
|
|
|
[mutex_lock_nested() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-02-03 02:12:30 +03:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.27 API change,
|
|
|
|
dnl # on_each_cpu() uses 3 args, no 'retry' argument
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
|
|
|
|
AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/smp.h>
|
|
|
|
],[
|
|
|
|
on_each_cpu(NULL, NULL, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
|
|
|
|
[on_each_cpu wants 3 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2009-02-05 02:15:41 +03:00
|
|
|
|
|
|
|
dnl #
|
2009-02-26 00:20:40 +03:00
|
|
|
dnl # 2.6.18 API change,
|
|
|
|
dnl # kallsyms_lookup_name no longer exported
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[kallsyms_lookup_name],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
|
|
|
|
[kallsyms_lookup_name() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl # Proposed API change,
|
|
|
|
dnl # This symbol is not available in stock kernels. You may build a
|
|
|
|
dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
|
|
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
|
|
|
dnl # your environment this is recommended.
|
2009-02-26 00:20:40 +03:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[get_vmalloc_info],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
|
|
|
|
[get_vmalloc_info() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
2009-05-21 01:23:13 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.17 API change
|
|
|
|
dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
|
|
|
|
dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
|
|
|
|
dnl # were exported in 2.6.17 for use by modules which was consistent with
|
|
|
|
dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
|
|
|
|
dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
|
|
|
|
dnl # were dropped entirely leaving modules no way to directly iterate over
|
|
|
|
dnl # the zone list. Because we need access to the zone helpers we check
|
|
|
|
dnl # if the kernel contains the old or new implementation. Then we check
|
|
|
|
dnl # to see if the symbols we need for each version are available. If they
|
|
|
|
dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
|
|
|
|
AC_MSG_CHECKING([whether symbol *_pgdat exist])
|
|
|
|
grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
|
|
|
|
rc=$?
|
|
|
|
if test $rc -eq 0; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2009-02-26 00:20:40 +03:00
|
|
|
dnl #
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl # Proposed API change,
|
|
|
|
dnl # This symbol is not available in stock kernels. You may build a
|
|
|
|
dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
|
|
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
|
|
|
dnl # your environment this is recommended.
|
2009-02-05 02:15:41 +03:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[first_online_pgdat],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
|
|
|
|
[first_online_pgdat() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl # Proposed API change,
|
|
|
|
dnl # This symbol is not available in stock kernels. You may build a
|
|
|
|
dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
|
|
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
|
|
|
dnl # your environment this is recommended.
|
2009-02-05 02:15:41 +03:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[next_online_pgdat],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
|
|
|
|
[next_online_pgdat() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl # Proposed API change,
|
|
|
|
dnl # This symbol is not available in stock kernels. You may build a
|
|
|
|
dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
|
|
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
|
|
|
dnl # your environment this is recommended.
|
2009-02-05 02:15:41 +03:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_NEXT_ZONE], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[next_zone],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_NEXT_ZONE, 1,
|
|
|
|
[next_zone() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2009-02-05 23:26:34 +03:00
|
|
|
|
2009-05-21 01:23:13 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.17 API change,
|
|
|
|
dnl # See SPL_AC_PGDAT_HELPERS for details.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_PGDAT_LIST], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[pgdat_list],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_PGDAT_LIST, 1,
|
|
|
|
[pgdat_list is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
2009-05-20 21:08:37 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.18 API change,
|
|
|
|
dnl # First introduced global_page_state() support as an inline.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
|
|
|
|
AC_MSG_CHECKING([whether global_page_state() is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2009-07-29 02:06:42 +04:00
|
|
|
#include <linux/mm.h>
|
2009-05-20 21:08:37 +04:00
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
unsigned long state __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
state = global_page_state(0);
|
2009-05-20 21:08:37 +04:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
|
|
|
|
[global_page_state() is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl #
|
2009-07-29 02:06:42 +04:00
|
|
|
dnl # 2.6.21 API change (plus subsequent naming convention changes),
|
|
|
|
dnl # Public global zone stats now include a free page count. However
|
|
|
|
dnl # the enumerated names of the counters have changed since this API
|
|
|
|
dnl # was introduced. We need to deduce the corrent name to use. This
|
|
|
|
dnl # replaces the priviate get_zone_counts() interface.
|
|
|
|
dnl #
|
|
|
|
dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
|
|
|
|
dnl # is 2.6.30 as of when this was written.
|
2009-03-17 22:16:31 +03:00
|
|
|
dnl #
|
2009-07-29 02:06:42 +04:00
|
|
|
AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
|
|
|
|
AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
|
2009-03-17 22:16:31 +03:00
|
|
|
SPL_LINUX_TRY_COMPILE([
|
2009-07-29 02:06:42 +04:00
|
|
|
#include <linux/mm.h>
|
2009-03-17 22:16:31 +03:00
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_FREE_PAGES;
|
2009-03-17 22:16:31 +03:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
2009-07-29 02:06:42 +04:00
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
|
|
|
|
[Page state NR_FREE_PAGES is available])
|
2009-03-17 22:16:31 +03:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2009-05-20 22:31:55 +04:00
|
|
|
|
2009-07-29 02:06:42 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.21 API change (plus subsequent naming convention changes),
|
|
|
|
dnl # Public global zone stats now include an inactive page count. However
|
|
|
|
dnl # the enumerated names of the counters have changed since this API
|
|
|
|
dnl # was introduced. We need to deduce the corrent name to use. This
|
|
|
|
dnl # replaces the priviate get_zone_counts() interface.
|
|
|
|
dnl #
|
|
|
|
dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
|
|
|
|
dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
|
|
|
|
dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
|
|
|
|
AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_INACTIVE;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
|
|
|
|
[Page state NR_INACTIVE is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_INACTIVE_ANON;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
|
|
|
|
[Page state NR_INACTIVE_ANON is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_INACTIVE_FILE;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
|
|
|
|
[Page state NR_INACTIVE_FILE is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.21 API change (plus subsequent naming convention changes),
|
|
|
|
dnl # Public global zone stats now include an active page count. However
|
|
|
|
dnl # the enumerated names of the counters have changed since this API
|
|
|
|
dnl # was introduced. We need to deduce the corrent name to use. This
|
|
|
|
dnl # replaces the priviate get_zone_counts() interface.
|
|
|
|
dnl #
|
|
|
|
dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
|
|
|
|
dnl # anonymous and file active pages. As of 2.6.28 it was split in
|
|
|
|
dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
|
|
|
|
AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_ACTIVE;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
|
|
|
|
[Page state NR_ACTIVE is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_ACTIVE_ANON;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
|
|
|
|
[Page state NR_ACTIVE_ANON is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/mm.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
enum zone_stat_item zsi __attribute__ ((unused));
|
2009-07-29 02:06:42 +04:00
|
|
|
zsi = NR_ACTIVE_FILE;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
|
|
|
|
[Page state NR_ACTIVE_FILE is available])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Proposed API change for legacy kernels.
|
|
|
|
dnl # This symbol is not available in older kernels. For kernels post
|
|
|
|
dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
|
|
|
|
dnl # page state information. This symbol is only used in legacy kernels
|
|
|
|
dnl # any only as a last resort.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
|
|
|
|
AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
],[
|
|
|
|
#if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
|
|
|
|
#error "global_page_state needs NR_FREE_PAGES"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
|
|
|
|
!defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
|
|
|
|
!defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
|
|
|
|
#error "global_page_state needs NR_ACTIVE*"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
|
|
|
|
!defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
|
|
|
|
!defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
|
|
|
|
#error "global_page_state needs NR_INACTIVE*"
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
|
|
|
|
[get_zone_counts() is needed])
|
|
|
|
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[get_zone_counts],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
|
|
|
|
[get_zone_counts() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2010-07-02 00:37:43 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.27 API change,
|
|
|
|
dnl # The user_path_dir() replaces __user_walk()
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_USER_PATH_DIR], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[user_path_at],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_USER_PATH_DIR, 1,
|
|
|
|
[user_path_dir() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
2009-10-02 03:06:15 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Symbol available in RHEL kernels not in stock kernels.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_SET_FS_PWD], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[set_fs_pwd],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_SET_FS_PWD, 1,
|
|
|
|
[set_fs_pwd() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.25 API change,
|
|
|
|
dnl # Simplied API by replacing mnt+dentry args with a single path arg.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
|
|
|
|
[AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/sched.h>
|
2009-11-11 01:06:57 +03:00
|
|
|
#include <linux/fs_struct.h>
|
2009-10-02 03:06:15 +04:00
|
|
|
],[
|
|
|
|
set_fs_pwd(NULL, NULL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
|
|
|
|
[set_fs_pwd() wants 2 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-05-20 22:31:55 +04:00
|
|
|
dnl #
|
|
|
|
dnl # SLES API change, never adopted in mainline,
|
|
|
|
dnl # Third 'struct vfsmount *' argument removed.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
|
|
|
|
[AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/fs.h>
|
|
|
|
],[
|
|
|
|
vfs_unlink(NULL, NULL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
|
|
|
|
[vfs_unlink() wants 2 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # SLES API change, never adopted in mainline,
|
|
|
|
dnl # Third and sixth 'struct vfsmount *' argument removed.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
|
|
|
|
[AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/fs.h>
|
|
|
|
],[
|
|
|
|
vfs_rename(NULL, NULL, NULL, NULL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
|
|
|
|
[vfs_rename() wants 4 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2009-07-28 04:18:59 +04:00
|
|
|
|
2010-11-09 22:15:32 +03:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.36 API change,
|
|
|
|
dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
|
|
|
|
dnl # a spinlock_t to improve the fastpath performance.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
|
|
|
|
AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/fs_struct.h>
|
|
|
|
],[
|
|
|
|
struct fs_struct fs;
|
|
|
|
spin_lock_init(&fs.lock);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
|
|
|
|
[struct fs_struct uses spinlock_t])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2009-07-28 04:18:59 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.29 API change,
|
|
|
|
dnl # check whether 'struct cred' exists
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_CRED_STRUCT], [
|
|
|
|
AC_MSG_CHECKING([whether struct cred exists])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/cred.h>
|
|
|
|
],[
|
2011-04-19 20:26:48 +04:00
|
|
|
struct cred *cr __attribute__ ((unused));
|
2009-07-28 04:18:59 +04:00
|
|
|
cr = NULL;
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2009-09-19 03:09:47 +04:00
|
|
|
dnl # Custom SPL patch may export this symbol.
|
2009-07-28 04:18:59 +04:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[groups_search],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
|
|
|
|
[groups_search() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2009-09-19 03:09:47 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.x API change,
|
|
|
|
dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[__put_task_struct],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
|
|
|
|
[__put_task_struct() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2010-03-04 23:14:56 +03:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.32 API change,
|
|
|
|
dnl # Unused 'struct file *' removed from prototype.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
|
|
|
|
AC_MSG_CHECKING([whether proc_handler() wants 5 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/sysctl.h>
|
|
|
|
],[
|
|
|
|
proc_dostring(NULL, 0, NULL, NULL, NULL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
|
|
|
|
[proc_handler() wants 5 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2010-06-12 01:48:18 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.x API change,
|
|
|
|
dnl # kvasprintf() function added.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KVASPRINTF], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[kvasprintf],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_KVASPRINTF, 1,
|
|
|
|
[kvasprintf() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2010-07-14 22:26:54 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.35 API change,
|
|
|
|
dnl # Unused 'struct dentry *' removed from prototype.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
|
|
|
|
AC_MSG_CHECKING([whether file_fsync() wants 3 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/buffer_head.h>
|
|
|
|
],[
|
|
|
|
file_fsync(NULL, NULL, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
|
|
|
|
[file_fsync() wants 3 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
2010-08-10 22:01:46 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
|
|
|
|
dnl # Earlier versions of rwsem_is_locked() were inline and had a race
|
|
|
|
dnl # condition. The fixed version is exported as a symbol. The race
|
|
|
|
dnl # condition is fixed by acquiring sem->wait_lock, so we must not
|
|
|
|
dnl # call that version while holding sem->wait_lock.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[rwsem_is_locked],
|
|
|
|
[lib/rwsem-spinlock.c],
|
|
|
|
[AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
|
|
|
|
[rwsem_is_locked() acquires sem->wait_lock])],
|
|
|
|
[])
|
|
|
|
])
|
2011-02-23 23:25:45 +03:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.37 API compat,
|
|
|
|
dnl # The function invalidate_inodes() is no longer exported by the kernel.
|
|
|
|
dnl # The prototype however is still available which means it is safe
|
|
|
|
dnl # to acquire the symbol's address using spl_kallsyms_lookup_name().
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[invalidate_inodes],
|
|
|
|
[],
|
|
|
|
[AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
|
|
|
|
[invalidate_inodes() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2011-03-31 04:44:35 +04:00
|
|
|
|
2011-04-19 00:47:43 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.39 API compat,
|
|
|
|
dnl # The function invalidate_inodes() now take 2 arguments. The second
|
|
|
|
dnl # 'kill_dirty' argument describes how invalidate_inodes() should
|
|
|
|
dnl # handle dirty inodes. Only when set will dirty inodes be discarded,
|
|
|
|
dnl # otherwise they will be handled as busy.
|
|
|
|
dnl #
|
|
|
|
dnl # Unfortunately, we don't have access to the invalidate_inodes()
|
|
|
|
dnl # prototype so it's not easy to check how many arguments it takes.
|
|
|
|
dnl # However, this change was done for the benefit of invalidate_device()
|
|
|
|
dnl # which also added an argument. The invalidate_device() symbol does
|
|
|
|
dnl # exist in the development headers so if it takes two arguments we
|
|
|
|
dnl # can fairly safely infer that invalidate_inodes() takes two arguments
|
|
|
|
dnl # as well. See commit 93b270f76e7ef3b81001576860c2701931cdc78b.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES],
|
|
|
|
[AC_MSG_CHECKING([whether invalidate_inodes() wants 2 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/fs.h>
|
|
|
|
],[
|
|
|
|
return __invalidate_device(NULL, 0);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_2ARGS_INVALIDATE_INODES, 1,
|
|
|
|
[invalidate_inodes() wants 2 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2011-03-31 04:44:35 +04:00
|
|
|
dnl #
|
|
|
|
dnl # 2.6.xx API compat,
|
|
|
|
dnl # There currently exists no exposed API to partially shrink the dcache.
|
|
|
|
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
|
|
|
dnl # which is called during memory pressure.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[shrink_dcache_memory],
|
|
|
|
[fs/dcache.c],
|
|
|
|
[AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
|
|
|
|
[shrink_dcache_memory() is available])],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.xx API compat,
|
|
|
|
dnl # There currently exists no exposed API to partially shrink the icache.
|
|
|
|
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
|
|
|
dnl # which is called during memory pressure.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[shrink_icache_memory],
|
|
|
|
[fs/inode.c],
|
|
|
|
[AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
|
|
|
|
[shrink_icache_memory() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2011-04-20 23:25:59 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.39 API compat,
|
|
|
|
dnl # The path_lookup() function has been renamed to kern_path_parent()
|
|
|
|
dnl # and the flags argument has been removed. The only behavior now
|
|
|
|
dnl # offered is that of LOOKUP_PARENT. The spl already always passed
|
|
|
|
dnl # this flag so dropping the flag does not impact us.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_KERN_PATH_PARENT], [
|
|
|
|
SPL_CHECK_SYMBOL_EXPORT(
|
|
|
|
[kern_path_parent],
|
|
|
|
[fs/namei.c],
|
|
|
|
[AC_DEFINE(HAVE_KERN_PATH_PARENT, 1,
|
|
|
|
[kern_path_parent() is available])],
|
|
|
|
[])
|
|
|
|
])
|
2011-04-21 01:22:35 +04:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # 2.6.39 API compat,
|
|
|
|
dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
|
|
|
|
dnl # This was done to avoid always having to allocate the maximum size
|
|
|
|
dnl # workspace (268K). The caller can now specific the windowBits and
|
|
|
|
dnl # memLevel compression parameters to get a smaller workspace.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
|
|
|
|
[AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
|
|
|
|
SPL_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/zlib.h>
|
|
|
|
],[
|
|
|
|
return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
|
|
|
|
[zlib_deflate_workspacesize() wants 2 args])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|