SPL_AC_TYPE_ATOMIC64_CMPXCHG
SPL_AC_TYPE_ATOMIC64_XCHG
SPL_AC_TYPE_UINTPTR_T
- SPL_AC_3ARGS_INIT_WORK
SPL_AC_2ARGS_REGISTER_SYSCTL
- SPL_AC_SET_SHRINKER
- SPL_AC_3ARGS_SHRINKER_CALLBACK
+ SPL_AC_SHRINKER_CALLBACK
SPL_AC_PATH_IN_NAMEIDATA
SPL_AC_TASK_CURR
SPL_AC_CTL_UNNUMBERED
SPL_AC_CTL_NAME
+ SPL_AC_VMALLOC_INFO
+ SPL_AC_PDE_DATA
SPL_AC_FLS64
SPL_AC_DEVICE_CREATE
SPL_AC_5ARGS_DEVICE_CREATE
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
SPL_AC_TIMESPEC_SUB
SPL_AC_INIT_UTSNAME
- SPL_AC_FDTABLE_HEADER
- SPL_AC_FILES_FDTABLE
- SPL_AC_CLEAR_CLOSE_ON_EXEC
SPL_AC_UACCESS_HEADER
SPL_AC_KMALLOC_NODE
SPL_AC_MONOTONIC_CLOCK
SPL_AC_GET_ZONE_COUNTS
SPL_AC_USER_PATH_DIR
SPL_AC_SET_FS_PWD
- SPL_AC_2ARGS_SET_FS_PWD
+ SPL_AC_SET_FS_PWD_WITH_CONST
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
SPL_AC_VFS_FSYNC
SPL_AC_2ARGS_VFS_FSYNC
+ SPL_AC_INODE_TRUNCATE_RANGE
SPL_AC_FS_STRUCT_SPINLOCK
SPL_AC_CRED_STRUCT
+ SPL_AC_KUIDGID_T
SPL_AC_GROUPS_SEARCH
SPL_AC_PUT_TASK_STRUCT
SPL_AC_5ARGS_PROC_HANDLER
SPL_AC_KVASPRINTF
SPL_AC_EXPORTED_RWSEM_IS_LOCKED
- SPL_AC_KERNEL_INVALIDATE_INODES
- SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES
+ SPL_AC_KERNEL_FALLOCATE
SPL_AC_SHRINK_DCACHE_MEMORY
SPL_AC_SHRINK_ICACHE_MEMORY
SPL_AC_KERN_PATH_PARENT_HEADER
SPL_AC_KERN_PATH_PARENT_SYMBOL
+ SPL_AC_KERN_PATH_LOCKED
+ SPL_AC_CONFIG_KALLSYMS
+ SPL_AC_CONFIG_ZLIB_INFLATE
+ SPL_AC_CONFIG_ZLIB_DEFLATE
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
SPL_AC_SHRINK_CONTROL_STRUCT
SPL_AC_RWSEM_SPINLOCK_IS_RAW
- SPL_AC_PMD_ALLOC_WITH_MASK
+ SPL_AC_SCHED_RT_HEADER
+ SPL_AC_2ARGS_VFS_GETATTR
+ SPL_AC_USLEEP_RANGE
+ SPL_AC_KMEM_CACHE_ALLOCFLAGS
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
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
+ *** is installed. If you are 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
if test -n "$sourcelink" && test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
else
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** 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.])
+ kernelsrc="[Not found]"
fi
else
if test "$kernelsrc" = "NONE"; then
fi
AC_MSG_RESULT([$kernelsrc])
+ if test ! -d "$kernelsrc"; then
+ AC_MSG_ERROR([
+ *** Please make sure the kernel devel package for your distribution
+ *** is installed and then try again. If that fails, you can specify the
+ *** location of the kernel source with the '--with-linux=PATH' option.])
+ fi
+
AC_MSG_CHECKING([kernel build directory])
if test -z "$kernelbuild"; then
if test -e "/lib/modules/$(uname -r)/build"; then
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 # 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 #
+dnl # By default, the generic spec file will be used because it requires
+dnl # minimal dependencies. Distribution specific spec files can be
+dnl # placed under the 'rpm/<distribution>' directory and enabled using
+dnl # the --with-spec=<distribution> configure option.
+dnl #
AC_DEFUN([SPL_AC_RPM], [
RPM=rpm
RPMBUILD=rpmbuild
AC_MSG_RESULT([$HAVE_RPMBUILD])
])
+ RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_LOG) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"'
+ RPM_DEFINE_UTIL=
+ RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
+ RPM_DEFINE_DKMS=
+
+ SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
+ SRPM_DEFINE_UTIL=
+ SRPM_DEFINE_KMOD=
+ SRPM_DEFINE_DKMS=
+
+ RPM_SPEC_DIR="rpm/generic"
+ AC_ARG_WITH([spec],
+ AS_HELP_STRING([--with-spec=SPEC],
+ [Spec files 'generic|fedora']),
+ [RPM_SPEC_DIR="rpm/$withval"])
+
+ AC_MSG_CHECKING([whether spec files are available])
+ AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)])
+
AC_SUBST(HAVE_RPM)
AC_SUBST(RPM)
AC_SUBST(RPM_VERSION)
AC_SUBST(HAVE_RPMBUILD)
AC_SUBST(RPMBUILD)
AC_SUBST(RPMBUILD_VERSION)
+
+ AC_SUBST(RPM_SPEC_DIR)
+ AC_SUBST(RPM_DEFINE_UTIL)
+ AC_SUBST(RPM_DEFINE_KMOD)
+ AC_SUBST(RPM_DEFINE_DKMS)
+ AC_SUBST(RPM_DEFINE_COMMON)
+ AC_SUBST(SRPM_DEFINE_UTIL)
+ AC_SUBST(SRPM_DEFINE_KMOD)
+ AC_SUBST(SRPM_DEFINE_DKMS)
+ AC_SUBST(SRPM_DEFINE_COMMON)
])
dnl #
AC_SUBST(DPKGBUILD_VERSION)
])
-dnl #
-dnl # Check for pacman+makepkg to build Arch Linux packages. If these
-dnl # tools are missing it is non-fatal but you will not be able to
-dnl # build Arch Linux packages and will be warned if you try too.
-dnl #
-AC_DEFUN([SPL_AC_PACMAN], [
- PACMAN=pacman
- MAKEPKG=makepkg
-
- AC_MSG_CHECKING([whether $PACMAN is available])
- tmp=$($PACMAN --version 2>/dev/null)
- AS_IF([test -n "$tmp"], [
- PACMAN_VERSION=$(echo $tmp |
- $AWK '/Pacman/ { print $[3] }' |
- $SED 's/^v//')
- HAVE_PACMAN=yes
- AC_MSG_RESULT([$HAVE_PACMAN ($PACMAN_VERSION)])
- ],[
- HAVE_PACMAN=no
- AC_MSG_RESULT([$HAVE_PACMAN])
- ])
-
- AC_MSG_CHECKING([whether $MAKEPKG is available])
- tmp=$($MAKEPKG --version 2>/dev/null)
- AS_IF([test -n "$tmp"], [
- MAKEPKG_VERSION=$(echo $tmp | $AWK '/makepkg/ { print $[3] }')
- HAVE_MAKEPKG=yes
- AC_MSG_RESULT([$HAVE_MAKEPKG ($MAKEPKG_VERSION)])
- ],[
- HAVE_MAKEPKG=no
- AC_MSG_RESULT([$HAVE_MAKEPKG])
- ])
-
- AC_SUBST(HAVE_PACMAN)
- AC_SUBST(PACMAN)
- AC_SUBST(PACMAN_VERSION)
-
- AC_SUBST(HAVE_MAKEPKG)
- AC_SUBST(MAKEPKG)
- AC_SUBST(MAKEPKG_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
redhat) DEFAULT_PACKAGE=rpm ;;
fedora) DEFAULT_PACKAGE=rpm ;;
gentoo) DEFAULT_PACKAGE=tgz ;;
- arch) DEFAULT_PACKAGE=arch ;;
+ arch) DEFAULT_PACKAGE=tgz ;;
sles) DEFAULT_PACKAGE=rpm ;;
slackware) DEFAULT_PACKAGE=tgz ;;
lunar) DEFAULT_PACKAGE=tgz ;;
SPL_AC_RPM
SPL_AC_DPKG
SPL_AC_ALIEN
-
- AS_IF([test "$VENDOR" = "arch"], [SPL_AC_PACMAN])
])
AC_DEFUN([SPL_AC_LICENSE], [
[enable_atomic_spinlocks=check])
SPL_LINUX_TRY_COMPILE([
- #include <asm/atomic.h>
+ #include <linux/fs.h>
],[
atomic64_t *ptr __attribute__ ((unused));
],[
AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
[AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
SPL_LINUX_TRY_COMPILE([
- #include <asm/atomic.h>
- #include <asm/system.h>
+ #include <linux/fs.h>
],[
atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
],[
AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
[AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
SPL_LINUX_TRY_COMPILE([
- #include <asm/atomic.h>
+ #include <linux/fs.h>
],[
atomic64_xchg((atomic64_t *)NULL, 0);
],[
])
])
-dnl #
-dnl # 2.6.20 API change,
-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([
- #include <linux/workqueue.h>
- ],[
- struct work_struct work __attribute__ ((unused));
- INIT_WORK(&work, NULL, NULL);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
- [INIT_WORK wants 3 args])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
-
dnl #
dnl # 2.6.21 API change,
dnl # 'register_sysctl_table' use only one argument instead of two
])
])
-dnl #
-dnl # 2.6.23 API change
-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])
- ])
-])
-
-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])
+AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
+ dnl #
+ dnl # 2.6.23 to 2.6.34 API change
+ dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
+ dnl #
+ AC_MSG_CHECKING([whether old 2-argument shrinker exists])
SPL_LINUX_TRY_COMPILE([
#include <linux/mm.h>
- int shrinker_cb(struct shrinker *, int, unsigned int);
+ int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
],[
struct shrinker cache_shrinker = {
.shrink = shrinker_cb,
register_shrinker(&cache_shrinker);
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
- [shrinker callback wants 3 args])
+ AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
+ [old shrinker callback wants 2 args])
],[
AC_MSG_RESULT(no)
+ dnl #
+ dnl # 2.6.35 - 2.6.39 API change
+ dnl # ->shrink(struct shrinker *,
+ dnl # int nr_to_scan, gfp_t gfp_mask)
+ dnl #
+ AC_MSG_CHECKING([whether old 3-argument shrinker exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ int shrinker_cb(struct shrinker *, int nr_to_scan,
+ gfp_t gfp_mask);
+ ],[
+ 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,
+ [old shrinker callback wants 3 args])
+ ],[
+ AC_MSG_RESULT(no)
+ dnl #
+ dnl # 3.0 - 3.11 API change
+ dnl # ->shrink(struct shrinker *,
+ dnl # struct shrink_control *sc)
+ dnl #
+ AC_MSG_CHECKING(
+ [whether new 2-argument shrinker exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ int shrinker_cb(struct shrinker *,
+ struct shrink_control *sc);
+ ],[
+ struct shrinker cache_shrinker = {
+ .shrink = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
+ [new shrinker callback wants 2 args])
+ ],[
+ AC_MSG_RESULT(no)
+ dnl #
+ dnl # 3.12 API change,
+ dnl # ->shrink() is logically split in to
+ dnl # ->count_objects() and ->scan_objects()
+ dnl #
+ AC_MSG_CHECKING(
+ [whether ->count_objects callback exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+
+ unsigned long shrinker_cb(
+ struct shrinker *,
+ struct shrink_control *sc);
+ ],[
+ struct shrinker cache_shrinker = {
+ .count_objects = shrinker_cb,
+ .scan_objects = shrinker_cb,
+ .seeks = DEFAULT_SEEKS,
+ };
+ register_shrinker(&cache_shrinker);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
+ 1, [->count_objects exists])
+ ],[
+ AC_MSG_ERROR(error)
+ ])
+ ])
+ ])
])
EXTRA_KCFLAGS="$tmp_flags"
])
])
])
-dnl #
-dnl # 2.6.26 API change,
-dnl # definition of struct fdtable relocated to linux/fdtable.h
-dnl #
-AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
- SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
-])
-
-dnl #
-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;
- struct fdtable *fdt __attribute__ ((unused));
- fdt = files_fdtable(files);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
-
-dnl #
-dnl # 3.4.0 API change,
-dnl # check whether '__clear_close_on_exec()' exists
-dnl #
-AC_DEFUN([SPL_AC_CLEAR_CLOSE_ON_EXEC], [
- AC_MSG_CHECKING([whether __clear_close_on_exec() is available])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/fdtable.h>
- ],[
- struct fdtable *fdt = NULL;
- int fd = 0;
-
- __clear_close_on_exec(fd, fdt);
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CLEAR_CLOSE_ON_EXEC, 1,
- [__clear_close_on_exec() is available])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
-
dnl #
dnl # 2.6.18 API change,
dnl # added linux/uaccess.h
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
#include <linux/mutex.h>
+ #include <linux/sched.h>
],[
struct mutex mtx __attribute__ ((unused));
mtx.owner = current;
AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
SPL_LINUX_TRY_COMPILE([
+ #include <linux/interrupt.h>
#include <linux/smp.h>
+
+ void on_each_cpu_func(void *data) { return; }
],[
- on_each_cpu(NULL, NULL, 0);
+ on_each_cpu(on_each_cpu_func, NULL, 0);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
])
])
+dnl #
+dnl # 3.10 API change,
+dnl # struct vmalloc_info is now declared in linux/vmalloc.h
+dnl #
+AC_DEFUN([SPL_AC_VMALLOC_INFO], [
+ AC_MSG_CHECKING([whether struct vmalloc_info is declared])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/vmalloc.h>
+ struct vmalloc_info { void *a; };
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_VMALLOC_INFO, 1, [yes])
+ ])
+])
+
+dnl #
+dnl # 3.10 API change,
+dnl # PDE is replaced by PDE_DATA
+dnl #
+AC_DEFUN([SPL_AC_PDE_DATA], [
+ AC_MSG_CHECKING([whether PDE_DATA() is available])
+ SPL_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/proc_fs.h>
+ ], [
+ PDE_DATA(NULL);
+ ], [PDE_DATA], [], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
dnl #
dnl # 2.6.17 API change
dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
])
dnl #
-dnl # 2.6.25 API change,
-dnl # Simplied API by replacing mnt+dentry args with a single path arg.
+dnl # 3.9 API change
+dnl # set_fs_pwd takes const struct path *
dnl #
-AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
- [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
+AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-Werror"
+ [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
SPL_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
+ #include <linux/spinlock.h>
#include <linux/fs_struct.h>
+ #include <linux/path.h>
+ void (*const set_fs_pwd_func)
+ (struct fs_struct *, const struct path *)
+ = set_fs_pwd;
],[
- set_fs_pwd(NULL, NULL);
+ return 0;
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
- [set_fs_pwd() wants 2 args])
+ AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
+ [set_fs_pwd() needs const path *])
],[
- AC_MSG_RESULT(no)
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/spinlock.h>
+ #include <linux/fs_struct.h>
+ #include <linux/path.h>
+ void (*const set_fs_pwd_func)
+ (struct fs_struct *, struct path *)
+ = set_fs_pwd;
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_ERROR(unknown)
+ ])
])
+ EXTRA_KCFLAGS="$tmp_flags"
])
-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);
+ vfs_unlink((struct inode *) NULL, (struct dentry *) NULL);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
[vfs_unlink() wants 2 args])
],[
AC_MSG_RESULT(no)
+ dnl #
+ dnl # Linux 3.13 API change
+ dnl # Added delegated inode
+ dnl #
+ AC_MSG_CHECKING([whether vfs_unlink() wants 3 args])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_unlink((struct inode *) NULL,
+ (struct dentry *) NULL,
+ (struct inode **) NULL);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_3ARGS_VFS_UNLINK, 1,
+ [vfs_unlink() wants 3 args])
+ ],[
+ AC_MSG_ERROR(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);
+ vfs_rename((struct inode *) NULL, (struct dentry *) NULL,
+ (struct inode *) NULL, (struct dentry *) NULL);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
[vfs_rename() wants 4 args])
],[
AC_MSG_RESULT(no)
+ dnl #
+ dnl # Linux 3.13 API change
+ dnl # Added delegated inode
+ dnl #
+ AC_MSG_CHECKING([whether vfs_rename() wants 5 args])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_rename((struct inode *) NULL,
+ (struct dentry *) NULL,
+ (struct inode *) NULL,
+ (struct dentry *) NULL,
+ (struct inode **) NULL);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1,
+ [vfs_rename() wants 5 args])
+ ],[
+ AC_MSG_RESULT(no)
+ dnl #
+ dnl # Linux 3.15 API change
+ dnl # Added flags
+ dnl #
+ AC_MSG_CHECKING([whether vfs_rename() wants 6 args])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_rename((struct inode *) NULL,
+ (struct dentry *) NULL,
+ (struct inode *) NULL,
+ (struct dentry *) NULL,
+ (struct inode **) NULL,
+ (unsigned int) 0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_6ARGS_VFS_RENAME, 1,
+ [vfs_rename() wants 6 args])
+ ],[
+ AC_MSG_ERROR(no)
+ ])
+ ])
])
])
])
])
+
+dnl #
+dnl # User namespaces, use kuid_t in place of uid_t
+dnl # where available. Not strictly a user namespaces thing
+dnl # but it should prevent surprises
+dnl #
+AC_DEFUN([SPL_AC_KUIDGID_T], [
+ AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/uidgid.h>
+ ], [
+ kuid_t userid = KUIDT_INIT(0);
+ kgid_t groupid = KGIDT_INIT(0);
+ ],[
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/uidgid.h>
+ ], [
+ kuid_t userid = 0;
+ kgid_t groupid = 0;
+ ],[
+ AC_MSG_RESULT(yes; optional)
+ ],[
+ AC_MSG_RESULT(yes; mandatory)
+ AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
+ ])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
dnl #
dnl # Custom SPL patch may export this symbol.
dnl #
[AC_MSG_CHECKING([whether groups_search() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/cred.h>
+ #ifdef HAVE_KUIDGID_T
+ #include <linux/uidgid.h>
+ #endif
], [
+ #ifdef HAVE_KUIDGID_T
+ groups_search(NULL, KGIDT_INIT(0));
+ #else
groups_search(NULL, 0);
+ #endif
], [groups_search], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available])
])
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 # 3.5 API change,
+dnl # inode_operations.truncate_range removed
dnl #
-AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
- [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
- #include <linux/rwsem.h>
- int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
- ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
+AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
+ AC_MSG_CHECKING([whether truncate_range() inode operation is available])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ struct inode_operations ops;
+ ops.truncate_range = NULL;
+ ],[
AC_MSG_RESULT(yes)
- AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
- [rwsem_is_locked() acquires sem->wait_lock])
- ], [
+ AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
+ [truncate_range() inode operation is available])
+ ],[
AC_MSG_RESULT(no)
])
])
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 #
-dnl # The Proxmox VE kernel contains a patch which renames the function
-dnl # invalidate_inodes() to invalidate_inodes_check(). In the process
-dnl # it adds a 'check' argument and a '#define invalidate_inodes(x)'
-dnl # compatibility wrapper for legacy callers. Therefore, if either
-dnl # of these functions are exported invalidate_inodes() can be
-dnl # safely used.
+dnl # Linux 2.6.38 - 3.x API
dnl #
-AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
- AC_MSG_CHECKING([whether invalidate_inodes() is available])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
+AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
+ AC_MSG_CHECKING([whether fops->fallocate() exists])
+ SPL_LINUX_TRY_COMPILE([
#include <linux/fs.h>
- ], [
- invalidate_inodes;
- ], [invalidate_inodes], [], [
+ ],[
+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
+ struct file_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+ ],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
- [invalidate_inodes() is available])
- ], [
+ AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
+ ],[
AC_MSG_RESULT(no)
])
+])
- AC_MSG_CHECKING([whether invalidate_inodes_check() is available])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
+dnl #
+dnl # Linux 2.6.x - 2.6.37 API
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
+ AC_MSG_CHECKING([whether iops->fallocate() exists])
+ SPL_LINUX_TRY_COMPILE([
#include <linux/fs.h>
- #ifndef invalidate_inodes
- #error invalidate_inodes is not a macro
- #endif
- ], [ ], [invalidate_inodes_check], [], [
+ ],[
+ long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
+ struct inode_operations fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
+ ],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
- [invalidate_inodes_check() is available])
- ], [
+ AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
+ ],[
AC_MSG_RESULT(no)
])
])
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])
+dnl # PaX Linux 2.6.38 - 3.x API
+dnl #
+AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
+ AC_MSG_CHECKING([whether fops->fallocate() exists])
SPL_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
- return __invalidate_device(NULL, 0);
+ long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
+ struct file_operations_no_const fops __attribute__ ((unused)) = {
+ .fallocate = fallocate,
+ };
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_INVALIDATE_INODES, 1,
- [invalidate_inodes() wants 2 args])
+ AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
],[
AC_MSG_RESULT(no)
])
])
+dnl #
+dnl # The fallocate callback was moved from the inode_operations
+dnl # structure to the file_operations structure.
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
+ SPL_AC_KERNEL_FILE_FALLOCATE
+ SPL_AC_KERNEL_INODE_FALLOCATE
+ SPL_AC_PAX_KERNEL_FILE_FALLOCATE
+])
+
+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],
+ [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
+ SPL_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/rwsem.h>
+ int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
+ ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
+ [rwsem_is_locked() acquires sem->wait_lock])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
+
dnl #
dnl # 2.6.xx API compat,
dnl # There currently exists no exposed API to partially shrink the dcache.
])
])
+dnl #
+dnl # 3.6 API compat,
+dnl # The kern_path_parent() function was replaced by the kern_path_locked()
+dnl # function to eliminate all struct nameidata usage outside fs/namei.c.
+dnl #
+AC_DEFUN([SPL_AC_KERN_PATH_LOCKED], [
+ SPL_CHECK_SYMBOL_HEADER(
+ [kern_path_locked],
+ [struct dentry \*kern_path_locked(const char \*, struct path \*)],
+ [include/linux/namei.h],
+ [AC_DEFINE(HAVE_KERN_PATH_LOCKED, 1,
+ [kern_path_locked() is available])],
+ [])
+])
+
+dnl #
+dnl # /proc/kallsyms support,
+dnl # Verify the kernel has CONFIG_KALLSYMS support enabled.
+dnl #
+AC_DEFUN([SPL_AC_CONFIG_KALLSYMS], [
+ AC_MSG_CHECKING([whether CONFIG_KALLSYMS is defined])
+ SPL_LINUX_TRY_COMPILE([
+ #if !defined(CONFIG_KALLSYMS)
+ #error CONFIG_KALLSYMS not defined
+ #endif
+ ],[ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ *** This kernel does not include the required kallsyms support.
+ *** Rebuild the kernel with CONFIG_KALLSYMS=y set.])
+ ])
+])
+
+dnl #
+dnl # zlib inflate compat,
+dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
+dnl #
+AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
+ AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
+ SPL_LINUX_TRY_COMPILE([
+ #if !defined(CONFIG_ZLIB_INFLATE) && \
+ !defined(CONFIG_ZLIB_INFLATE_MODULE)
+ #error CONFIG_ZLIB_INFLATE not defined
+ #endif
+ ],[ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ *** This kernel does not include the required zlib inflate support.
+ *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
+ ])
+])
+
+dnl #
+dnl # zlib deflate compat,
+dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
+dnl #
+AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
+ AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
+ SPL_LINUX_TRY_COMPILE([
+ #if !defined(CONFIG_ZLIB_DEFLATE) && \
+ !defined(CONFIG_ZLIB_DEFLATE_MODULE)
+ #error CONFIG_ZLIB_DEFLATE not defined
+ #endif
+ ],[ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ *** This kernel does not include the required zlib deflate support.
+ *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
+ ])
+])
+
dnl #
dnl # 2.6.39 API compat,
dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
])
dnl #
-dnl # Proposed VM Subsystem Bug Fix
-dnl # https://bugs.gentoo.org/show_bug.cgi?id=416685
+dnl # 3.9 API change,
+dnl # Moved things from linux/sched.h to linux/sched/rt.h
dnl #
-dnl # Make __pte_alloc_kernel() honor gfp flags passed to vmalloc()
-dnl # This is detected by checking a macro that is changed to support this.
-dnl #
-AC_DEFUN([SPL_AC_PMD_ALLOC_WITH_MASK], [
- AC_MSG_CHECKING([whether pmd_alloc_with_mask exists])
+AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
+ [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
SPL_LINUX_TRY_COMPILE([
- #if !defined(CONFIG_MMU)
- #define CONFIG_MMU
- #endif
+ #include <linux/sched.h>
+ #include <linux/sched/rt.h>
+ ],[
+ return 0;
+ ],[
+ AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
- #if defined(RCH_HAS_4LEVEL_HACK)
- #undef RCH_HAS_4LEVEL_HACK
- #endif
+dnl #
+dnl # 3.9 API change,
+dnl # vfs_getattr() uses 2 args
+dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
+dnl #
+AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
+ AC_MSG_CHECKING([whether vfs_getattr() wants])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_getattr((struct path *) NULL,
+ (struct kstat *)NULL);
+ ],[
+ AC_MSG_RESULT(2 args)
+ AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
+ [vfs_getattr wants 2 args])
+ ],[
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_getattr((struct vfsmount *)NULL,
+ (struct dentry *)NULL,
+ (struct kstat *)NULL);
+ ],[
+ AC_MSG_RESULT(3 args)
+ ],[
+ AC_MSG_ERROR(unknown)
+ ])
+ ])
+])
- #include <linux/mm.h>
+dnl #
+dnl # 2.6.36 API compatibility.
+dnl # Added usleep_range timer.
+dnl # usleep_range is a finer precision implementation of msleep
+dnl # designed to be a drop-in replacement for udelay where a precise
+dnl # sleep / busy-wait is unnecessary.
+dnl #
+AC_DEFUN([SPL_AC_USLEEP_RANGE], [
+ AC_MSG_CHECKING([whether usleep_range() is available])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/delay.h>
],[
- struct mm_struct init_mm;
- pud_t *pud = NULL;
- unsigned long addr = 0;
- gfp_t gfp_mask = GFP_KERNEL;
+ usleep_range(0, 0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_USLEEP_RANGE, 1,
+ [usleep_range is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
- pmd_alloc_with_mask(&init_mm, pud, addr, gfp_mask);
+dnl #
+dnl # 2.6.35 API change,
+dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
+dnl # private allocation flags which are applied when allocating a new slab
+dnl # in kmem_getpages(). Unfortunately there is no public API for setting
+dnl # non-default flags.
+dnl #
+AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
+ AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/slab.h>
+ ],[
+ struct kmem_cache cachep __attribute__ ((unused));
+ cachep.allocflags = GFP_KERNEL;
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PMD_ALLOC_WITH_MASK, 1,
- [pmd_alloc_with_mask exists])
+ AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
+ [struct kmem_cache has allocflags])
],[
AC_MSG_RESULT(no)
+
+ AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/slab.h>
+ ],[
+ struct kmem_cache cachep __attribute__ ((unused));
+ cachep.gfpflags = GFP_KERNEL;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
+ [struct kmem_cache has gfpflags])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
])
])