2 dnl # 2.6.35 API change,
3 dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
4 dnl # private allocation flags which are applied when allocating a new slab
5 dnl # in kmem_getpages(). Unfortunately there is no public API for setting
6 dnl # non-default flags.
8 AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [
9 AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
10 ZFS_LINUX_TRY_COMPILE([
11 #include <linux/slab.h>
13 struct kmem_cache cachep __attribute__ ((unused));
14 cachep.allocflags = GFP_KERNEL;
17 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
18 [struct kmem_cache has allocflags])
22 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
23 ZFS_LINUX_TRY_COMPILE([
24 #include <linux/slab.h>
26 struct kmem_cache cachep __attribute__ ((unused));
27 cachep.gfpflags = GFP_KERNEL;
30 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
31 [struct kmem_cache has gfpflags])
39 dnl # grsecurity API change,
40 dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
41 dnl # kmem_cache_create_usercopy().
43 AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
44 AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
45 tmp_flags="$EXTRA_KCFLAGS"
46 EXTRA_KCFLAGS="-Werror"
47 ZFS_LINUX_TRY_COMPILE([
48 #include <linux/slab.h>
49 static void ctor(void *foo)
54 struct kmem_cache *skc_linux_cache;
55 const char *name = "test";
58 unsigned long flags = 0;
59 size_t useroffset = 0;
60 size_t usersize = size - useroffset;
62 skc_linux_cache = kmem_cache_create_usercopy(
63 name, size, align, flags, useroffset, usersize, ctor);
66 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
67 [kmem_cache_create_usercopy() exists])
71 EXTRA_KCFLAGS="$tmp_flags"