-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the kernel interface configure checks in to seperate m4 macro files. This is intended to facilitate moving the spl source code in to the zfs repository. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #682
- Loading branch information
1 parent
5461eef
commit 48ef8ba
Showing
22 changed files
with
932 additions
and
956 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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) | ||
]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
dnl # | ||
dnl # Linux 2.6.38 - 3.x API | ||
dnl # | ||
AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [ | ||
AC_MSG_CHECKING([whether fops->fallocate() exists]) | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/fs.h> | ||
],[ | ||
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_FILE_FALLOCATE, 1, [fops->fallocate() exists]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
]) | ||
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> | ||
],[ | ||
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_INODE_FALLOCATE, 1, [fops->fallocate() exists]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
]) | ||
|
||
dnl # | ||
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> | ||
],[ | ||
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_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 | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
dnl # | ||
dnl # 4.9 API change | ||
dnl # group_info changed from 2d array via >blocks to 1d array via ->gid | ||
dnl # | ||
AC_DEFUN([SPL_AC_GROUP_INFO_GID], [ | ||
AC_MSG_CHECKING([whether group_info->gid exists]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/cred.h> | ||
],[ | ||
struct group_info *gi = groups_alloc(1); | ||
gi->gid[0] = KGIDT_INIT(0); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
dnl # | ||
dnl # 4.7 API change | ||
dnl # i_mutex is changed to i_rwsem. Instead of directly using | ||
dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared() | ||
dnl # We test inode_lock_shared because inode_lock is introduced earlier. | ||
dnl # | ||
AC_DEFUN([SPL_AC_INODE_LOCK], [ | ||
AC_MSG_CHECKING([whether inode_lock_shared() exists]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/fs.h> | ||
],[ | ||
struct inode *inode = NULL; | ||
inode_lock_shared(inode); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1, [yes]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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_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) | ||
]) | ||
]) | ||
]) | ||
|
||
dnl # | ||
dnl # grsecurity API change, | ||
dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by | ||
dnl # kmem_cache_create_usercopy(). | ||
dnl # | ||
AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [ | ||
AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/slab.h> | ||
static void ctor(void *foo) | ||
{ | ||
// fake ctor | ||
} | ||
],[ | ||
struct kmem_cache *skc_linux_cache; | ||
const char *name = "test"; | ||
size_t size = 4096; | ||
size_t align = 8; | ||
unsigned long flags = 0; | ||
size_t useroffset = 0; | ||
size_t usersize = size - useroffset; | ||
skc_linux_cache = kmem_cache_create_usercopy( | ||
name, size, align, flags, useroffset, usersize, ctor); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1, | ||
[kmem_cache_create_usercopy() exists]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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) | ||
]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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) | ||
]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
dnl # | ||
dnl # 4.14 API change | ||
dnl # kernel_write() which was introduced in 3.9 was updated to take | ||
dnl # the offset as a pointer which is needed by vn_rdwr(). | ||
dnl # | ||
AC_DEFUN([SPL_AC_KERNEL_WRITE], [ | ||
AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/fs.h> | ||
],[ | ||
struct file *file = NULL; | ||
const void *buf = NULL; | ||
size_t count = 0; | ||
loff_t *pos = NULL; | ||
ssize_t ret; | ||
ret = kernel_write(file, buf, count, pos); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1, | ||
[kernel_write() take loff_t pointer]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) | ||
|
||
dnl # | ||
dnl # 4.14 API change | ||
dnl # kernel_read() which has existed for forever was updated to take | ||
dnl # the offset as a pointer which is needed by vn_rdwr(). | ||
dnl # | ||
AC_DEFUN([SPL_AC_KERNEL_READ], [ | ||
AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/fs.h> | ||
],[ | ||
struct file *file = NULL; | ||
void *buf = NULL; | ||
size_t count = 0; | ||
loff_t *pos = NULL; | ||
ssize_t ret; | ||
ret = kernel_read(file, buf, count, pos); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1, | ||
[kernel_read() take loff_t pointer]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
dnl # | ||
dnl # 3.1 API Change | ||
dnl # | ||
dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to | ||
dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1. | ||
dnl # | ||
AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [ | ||
AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/rwsem.h> | ||
],[ | ||
struct rw_semaphore dummy_semaphore __attribute__ ((unused)); | ||
raw_spinlock_t dummy_lock __attribute__ ((unused)) = | ||
__RAW_SPIN_LOCK_INITIALIZER(dummy_lock); | ||
dummy_semaphore.wait_lock = dummy_lock; | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1, | ||
[struct rw_semaphore member wait_lock is raw_spinlock_t]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) | ||
|
||
dnl # | ||
dnl # 3.16 API Change | ||
dnl # | ||
dnl # rwsem-spinlock "->activity" changed to "->count" | ||
dnl # | ||
AC_DEFUN([SPL_AC_RWSEM_ACTIVITY], [ | ||
AC_MSG_CHECKING([whether struct rw_semaphore has member activity]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/rwsem.h> | ||
],[ | ||
struct rw_semaphore dummy_semaphore __attribute__ ((unused)); | ||
dummy_semaphore.activity = 0; | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_RWSEM_ACTIVITY, 1, | ||
[struct rw_semaphore has member activity]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) | ||
|
||
dnl # | ||
dnl # 4.8 API Change | ||
dnl # | ||
dnl # rwsem "->count" changed to atomic_long_t type | ||
dnl # | ||
AC_DEFUN([SPL_AC_RWSEM_ATOMIC_LONG_COUNT], [ | ||
AC_MSG_CHECKING( | ||
[whether struct rw_semaphore has atomic_long_t member count]) | ||
tmp_flags="$EXTRA_KCFLAGS" | ||
EXTRA_KCFLAGS="-Werror" | ||
SPL_LINUX_TRY_COMPILE([ | ||
#include <linux/rwsem.h> | ||
],[ | ||
DECLARE_RWSEM(dummy_semaphore); | ||
(void) atomic_long_read(&dummy_semaphore.count); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_RWSEM_ATOMIC_LONG_COUNT, 1, | ||
[struct rw_semaphore has atomic_long_t member count]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
EXTRA_KCFLAGS="$tmp_flags" | ||
]) |
Oops, something went wrong.