AC_SUBST(HAVE_NLA_POLICY_EXACT_LEN, undef)
fi
+AC_MSG_CHECKING([kernel source for kvzalloc() in mm.h])
+if test -f $ksourcedir/include/linux/mm.h && \
+ $GREP -q 'static inline void \*kvzalloc(' $ksourcedir/include/linux/mm.h; then
+ AC_MSG_RESULT(yes)
+ AC_SUBST(HAVE_KVZALLOC, define)
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST(HAVE_KVZALLOC, undef)
+fi
+
+AC_MSG_CHECKING([kernel source for GFP_KERNEL_ACCOUNT in gfp.h])
+if test -f $ksourcedir/include/linux/gfp.h && \
+ $GREP -q 'define GFP_KERNEL_ACCOUNT' $ksourcedir/include/linux/gfp.h; then
+ AC_MSG_RESULT(yes)
+ AC_SUBST(HAVE_GFP_KERNEL_ACCOUNT, define)
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST(HAVE_GFP_KERNEL_ACCOUNT, undef)
+fi
+
AC_MSG_CHECKING([kernel source for struct net_generic])
if test -f $ksourcedir/include/net/netns/generic.h && \
$GREP -q 'struct net_generic' $ksourcedir/include/net/netns/generic.h; then
#@HAVE_LIST_FOR_EACH_ENTRY_RCU_FOUR_ARGS@ HAVE_LIST_FOR_EACH_ENTRY_RCU_FOUR_ARGS
#@HAVE_SKB_PROTOCOL@ HAVE_SKB_PROTOCOL
#@HAVE_NLA_POLICY_EXACT_LEN@ HAVE_NLA_POLICY_EXACT_LEN
+#@HAVE_KVZALLOC@ HAVE_KVZALLOC
+#@HAVE_GFP_KERNEL_ACCOUNT@ HAVE_GFP_KERNEL_ACCOUNT
#ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
#include <linux/module.h>
#endif
#ifndef HAVE_NLA_POLICY_EXACT_LEN
-#define HAVE_NLA_POLICY_EXACT_LEN(_len) { \
+#define NLA_POLICY_EXACT_LEN(_len) { \
.type = NLA_UNSPEC, \
.len = _len \
}
#endif
+#ifndef HAVE_KVZALLOC
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#ifndef GFP_KERNEL_ACCOUNT
+#define GFP_KERNEL_ACCOUNT GFP_KERNEL
+#endif
+static inline void *kvzalloc(size_t size, gfp_t flags)
+{
+ void *members = NULL;
+
+ if (size < KMALLOC_MAX_SIZE)
+ members = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
+
+ if (members) {
+ pr_debug("%p: allocated with kmalloc\n", members);
+ return members;
+ }
+
+ members = vzalloc(size);
+ if (!members)
+ return NULL;
+ pr_debug("%p: allocated with vmalloc\n", members);
+
+ return members;
+}
+#endif
+
/* Compiler attributes */
#ifndef __has_attribute
# define __has_attribute(x) __GCC4_has_attribute_##x