AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL
-
- dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
- dnl # compiler options are added by the kernel build system.
- abs_srcdir=`readlink -f ${srcdir}`
- KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
- KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir}/include"
- KERNELCPPFLAGS="$KERNELCPPFLAGS -include ${abs_srcdir}/spl_config.h"
+ SPL_AC_KERNEL_CONFIG
if test "${LINUX_OBJ}" != "${LINUX}"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
-
AC_SUBST(KERNELMAKE_PARAMS)
+
+ KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
AC_SUBST(KERNELCPPFLAGS)
SPL_AC_DEBUG
SPL_AC_3ARGS_INIT_WORK
SPL_AC_2ARGS_REGISTER_SYSCTL
SPL_AC_SET_SHRINKER
+ SPL_AC_3ARGS_SHRINKER_CALLBACK
SPL_AC_PATH_IN_NAMEIDATA
SPL_AC_TASK_CURR
SPL_AC_CTL_UNNUMBERED
+ SPL_AC_CTL_NAME
SPL_AC_FLS64
SPL_AC_DEVICE_CREATE
SPL_AC_5ARGS_DEVICE_CREATE
SPL_AC_INODE_I_MUTEX
SPL_AC_MUTEX_OWNER
SPL_AC_MUTEX_LOCK_NESTED
- SPL_AC_DIV64_64
- SPL_AC_DIV64_U64
SPL_AC_3ARGS_ON_EACH_CPU
SPL_AC_KALLSYMS_LOOKUP_NAME
SPL_AC_GET_VMALLOC_INFO
SPL_AC_ZONE_STAT_ITEM_INACTIVE
SPL_AC_ZONE_STAT_ITEM_ACTIVE
SPL_AC_GET_ZONE_COUNTS
+ SPL_AC_USER_PATH_DIR
SPL_AC_SET_FS_PWD
SPL_AC_2ARGS_SET_FS_PWD
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
+ SPL_AC_FS_STRUCT_SPINLOCK
SPL_AC_CRED_STRUCT
SPL_AC_GROUPS_SEARCH
SPL_AC_PUT_TASK_STRUCT
SPL_AC_5ARGS_PROC_HANDLER
SPL_AC_KVASPRINTF
+ SPL_AC_3ARGS_FILE_FSYNC
+ SPL_AC_EXPORTED_RWSEM_IS_LOCKED
+ SPL_AC_KERNEL_INVALIDATE_INODES
+ SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES
+ SPL_AC_SHRINK_DCACHE_MEMORY
+ SPL_AC_SHRINK_ICACHE_MEMORY
+ SPL_AC_KERN_PATH_PARENT
+ SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
else
LINUX_SYMBOLS=Module.symvers
fi
+
+ 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
else
LINUX_SYMBOLS=NONE
fi
AC_MSG_CHECKING([kernel source directory])
if test -z "$kernelsrc"; then
- headersdir="/lib/modules/$(uname -r)/build"
- if test -e "$headersdir"; then
+ 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"
sourcelink=$(readlink -f "$headersdir")
else
sourcelink=$(ls -1d /usr/src/kernels/* \
2>/dev/null | grep -v obj | tail -1)
fi
- if test -e ${sourcelink}; then
+ if test -n "$sourcelink" && test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
else
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
- *** Please specify the location of the kernel source
- *** with the '--with-linux=PATH' option])
+ *** 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.])
fi
else
if test "$kernelsrc" = "NONE"; then
AC_MSG_RESULT([$kernelsrc])
AC_MSG_CHECKING([kernel build directory])
if test -z "$kernelbuild"; then
- if test -d ${kernelsrc}-obj/`arch`/`arch`; then
- kernelbuild=${kernelsrc}-obj/`arch`/`arch`
- elif test -d ${kernelsrc}-obj/`arch`/default; then
- kernelbuild=${kernelsrc}-obj/`arch`/default
- elif test -d `dirname ${kernelsrc}`/build-`arch`; then
- kernelbuild=`dirname ${kernelsrc}`/build-`arch`
+ 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
+ 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}
else
kernelbuild=${kernelsrc}
fi
AC_MSG_RESULT([$kernelbuild])
AC_MSG_CHECKING([kernel source version])
- if test -r $kernelbuild/include/linux/version.h &&
- fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
+ 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
- kernsrcver=`(echo "#include <linux/version.h>";
+ if test "$utsrelease"; then
+ kernsrcver=`(echo "#include <$utsrelease>";
echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2`
- elif test -r $kernelbuild/include/linux/utsrelease.h &&
- fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
-
- kernsrcver=`(echo "#include <linux/utsrelease.h>";
- echo "kernsrcver=UTS_RELEASE") |
- cpp -I $kernelbuild/include |
- grep "^kernsrcver=" | cut -d \" -f 2`
- fi
-
- if test -z "$kernsrcver"; then
+ if test -z "$kernsrcver"; then
+ AC_MSG_RESULT([Not found])
+ AC_MSG_ERROR([*** Cannot determine kernel version.])
+ fi
+ else
AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** Cannot determine the version of the linux kernel source.
- *** Please prepare the kernel before running this script])
+ AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
fi
AC_MSG_RESULT([$kernsrcver])
SPL_AC_MODULE_SYMVERS
])
+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.]), [])
+])
+
dnl #
dnl # Default SPL user configuration
dnl #
AC_DEFUN([SPL_AC_CONFIG_USER], [])
+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], [
+ 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)
+
+ 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
+])
+
AC_DEFUN([SPL_AC_LICENSE], [
AC_MSG_CHECKING([spl license])
LICENSE=GPL
dnl # By default this support is disabled.
dnl #
AC_DEFUN([SPL_AC_DEBUG], [
+ AC_MSG_CHECKING([whether debugging is enabled])
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],
- [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"],
- [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"])
+ [
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
+ DEBUG_CFLAGS="-DDEBUG -Werror"
+ ],
+ [
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+ DEBUG_CFLAGS="-DNDEBUG"
+ ])
- AC_MSG_CHECKING([whether debugging is enabled])
+ AC_SUBST(DEBUG_CFLAGS)
AC_MSG_RESULT([$enable_debug])
])
dnl # SPL_LINUX_CONFTEST
dnl #
AC_DEFUN([SPL_LINUX_CONFTEST], [
-cat >conftest.c <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.c
$1
_ACEOF
])
SPL_LINUX_TRY_COMPILE([
#include <asm/atomic.h>
],[
- atomic64_t *ptr;
+ atomic64_t *ptr __attribute__ ((unused));
],[
have_atomic64_t=yes
AC_DEFINE(HAVE_ATOMIC64_T, 1,
[AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
SPL_LINUX_TRY_COMPILE([
#include <asm/atomic.h>
+ #include <asm/system.h>
],[
atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
],[
SPL_LINUX_TRY_COMPILE([
#include <linux/types.h>
],[
- uintptr_t *ptr;
+ uintptr_t *ptr __attribute__ ((unused));
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_UINTPTR_T, 1,
SPL_LINUX_TRY_COMPILE([
#include <linux/workqueue.h>
],[
- struct work_struct work;
+ struct work_struct work __attribute__ ((unused));
INIT_WORK(&work, NULL, NULL);
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/sysctl.h>
],[
- return register_sysctl_table(NULL,0);
+ (void) register_sysctl_table(NULL, 0);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
])
])
+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"
+])
+
dnl #
dnl # 2.6.25 API change,
dnl # struct path entry added to struct nameidata
SPL_LINUX_TRY_COMPILE([
#include <linux/namei.h>
],[
- struct nameidata nd;
+ struct nameidata nd __attribute__ ((unused));
nd.path.mnt = NULL;
nd.path.dentry = NULL;
])
])
+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>
+ ],[
+ struct ctl_table ctl __attribute__ ((unused));
+ ctl.ctl_name = 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
dnl #
dnl # 2.6.16 API change.
dnl # Check if 'fls64()' is available
SPL_LINUX_TRY_COMPILE([
#include <linux/time.h>
],[
- struct timespec a, b, c = { 0 };
+ struct timespec a = { 0 };
+ struct timespec b = { 0 };
+ struct timespec c __attribute__ ((unused));
c = timespec_sub(a, b);
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/utsname.h>
],[
- struct new_utsname *a = init_utsname();
+ struct new_utsname *a __attribute__ ((unused));
+ a = init_utsname();
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
#endif
],[
struct files_struct *files = current->files;
- struct fdtable *fdt = files_fdtable(files);
+ struct fdtable *fdt __attribute__ ((unused));
+ fdt = files_fdtable(files);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
SPL_LINUX_TRY_COMPILE([
#include <linux/slab.h>
],[
- void *a = kmalloc_node(1, GFP_KERNEL, 0);
+ void *a __attribute__ ((unused));
+ a = kmalloc_node(1, GFP_KERNEL, 0);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
SPL_LINUX_TRY_COMPILE([
#include <linux/mutex.h>
],[
- struct mutex mtx;
+ struct mutex mtx __attribute__ ((unused));
mtx.owner = NULL;
],[
AC_MSG_RESULT(yes)
])
])
-dnl #
-dnl # 2.6.22 API change,
-dnl # First introduced 'div64_64()' in lib/div64.c
-dnl
-AC_DEFUN([SPL_AC_DIV64_64], [
- SPL_CHECK_SYMBOL_EXPORT(
- [div64_64],
- [],
- [AC_DEFINE(HAVE_DIV64_64, 1,
- [div64_64() is available])],
- [])
-])
-
-dnl #
-dnl # 2.6.26 API change,
-dnl # Renamed 'div64_64()' to 'div64_u64' in lib/div64.c
-dnl #
-AC_DEFUN([SPL_AC_DIV64_U64], [
- SPL_CHECK_SYMBOL_EXPORT(
- [div64_u64],
- [],
- [AC_DEFINE(HAVE_DIV64_U64, 1,
- [div64_u64() is available])],
- [])
-])
-
dnl #
dnl # 2.6.27 API change,
dnl # on_each_cpu() uses 3 args, no 'retry' argument
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- unsigned long state;
+ unsigned long state __attribute__ ((unused));
state = global_page_state(0);
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_FREE_PAGES;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_INACTIVE;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_INACTIVE_ANON;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_INACTIVE_FILE;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_ACTIVE;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_ACTIVE_ANON;
],[
AC_MSG_RESULT(yes)
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
],[
- enum zone_stat_item zsi;
+ enum zone_stat_item zsi __attribute__ ((unused));
zsi = NR_ACTIVE_FILE;
],[
AC_MSG_RESULT(yes)
])
])
+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])],
+ [])
+])
+
dnl #
dnl # Symbol available in RHEL kernels not in stock kernels.
dnl #
])
])
+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)
+ ])
+])
+
dnl #
dnl # 2.6.29 API change,
dnl # check whether 'struct cred' exists
SPL_LINUX_TRY_COMPILE([
#include <linux/cred.h>
],[
- struct cred *cr;
+ struct cred *cr __attribute__ ((unused));
cr = NULL;
],[
AC_MSG_RESULT(yes)
[kvasprintf() is available])],
[])
])
+
+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)
+ ])
+])
+
+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])],
+ [])
+])
+
+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])],
+ [])
+])
+
+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)
+ ])
+])
+
+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])],
+ [])
+])
+
+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])],
+ [])
+])
+
+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)
+ ])
+])