]> git.proxmox.com Git - mirror_spl-debian.git/blob - config/kernel-kmem-cache.m4
dch: close a bug and refresh timestamp.
[mirror_spl-debian.git] / config / kernel-kmem-cache.m4
1 dnl #
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.
7 dnl #
8 AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
9 AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
10 SPL_LINUX_TRY_COMPILE([
11 #include <linux/slab.h>
12 ],[
13 struct kmem_cache cachep __attribute__ ((unused));
14 cachep.allocflags = GFP_KERNEL;
15 ],[
16 AC_MSG_RESULT(yes)
17 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
18 [struct kmem_cache has allocflags])
19 ],[
20 AC_MSG_RESULT(no)
21
22 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
23 SPL_LINUX_TRY_COMPILE([
24 #include <linux/slab.h>
25 ],[
26 struct kmem_cache cachep __attribute__ ((unused));
27 cachep.gfpflags = GFP_KERNEL;
28 ],[
29 AC_MSG_RESULT(yes)
30 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
31 [struct kmem_cache has gfpflags])
32 ],[
33 AC_MSG_RESULT(no)
34 ])
35 ])
36 ])
37
38 dnl #
39 dnl # grsecurity API change,
40 dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
41 dnl # kmem_cache_create_usercopy().
42 dnl #
43 AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [
44 AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
45 tmp_flags="$EXTRA_KCFLAGS"
46 EXTRA_KCFLAGS="-Werror"
47 SPL_LINUX_TRY_COMPILE([
48 #include <linux/slab.h>
49 static void ctor(void *foo)
50 {
51 // fake ctor
52 }
53 ],[
54 struct kmem_cache *skc_linux_cache;
55 const char *name = "test";
56 size_t size = 4096;
57 size_t align = 8;
58 unsigned long flags = 0;
59 size_t useroffset = 0;
60 size_t usersize = size - useroffset;
61
62 skc_linux_cache = kmem_cache_create_usercopy(
63 name, size, align, flags, useroffset, usersize, ctor);
64 ],[
65 AC_MSG_RESULT(yes)
66 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_USERCOPY, 1,
67 [kmem_cache_create_usercopy() exists])
68 ],[
69 AC_MSG_RESULT(no)
70 ])
71 EXTRA_KCFLAGS="$tmp_flags"
72 ])