From b34df2f03e83524e0e314142bb7bbb7b7cef5465 Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Tue, 13 Jan 2015 15:03:00 +0200 Subject: [PATCH] Added kvfree backport Signed-off-by: Vladimir Sokolovsky --- compat/Makefile | 1 + compat/compat-3.15.c | 12 ++++++++++++ config/rdma.m4 | 15 --------------- include/linux/compat-3.15.h | 13 +++++++++++++ 4 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 compat/compat-3.15.c create mode 100644 include/linux/compat-3.15.h diff --git a/compat/Makefile b/compat/Makefile index b58baac..7e0ba4f 100644 --- a/compat/Makefile +++ b/compat/Makefile @@ -53,6 +53,7 @@ compat-$(CONFIG_COMPAT_KERNEL_3_9) += compat-3.9.o compat-$(CONFIG_COMPAT_KERNEL_3_11) += compat-3.11.o compat-$(CONFIG_COMPAT_KERNEL_3_12) += compat-3.12.o compat-$(CONFIG_COMPAT_KERNEL_3_13) += compat-3.13.o +compat-$(CONFIG_COMPAT_KERNEL_3_15) += compat-3.15.o compat-$(CONFIG_COMPAT_KERNEL_3_16) += compat-3.16.o compat-$(CONFIG_COMPAT_KERNEL_3_18) += compat-3.18.o diff --git a/compat/compat-3.15.c b/compat/compat-3.15.c new file mode 100644 index 0000000..a39c2a5 --- /dev/null +++ b/compat/compat-3.15.c @@ -0,0 +1,12 @@ +#include +#include + +#define kvfree LINUX_BACKPORT(kvfree) +void kvfree(const void *addr) +{ + if (is_vmalloc_addr(addr)) + vfree(addr); + else + kfree(addr); +} +EXPORT_SYMBOL(kvfree); diff --git a/config/rdma.m4 b/config/rdma.m4 index 6aae3dc..b4c07fa 100644 --- a/config/rdma.m4 +++ b/config/rdma.m4 @@ -675,21 +675,6 @@ AC_DEFUN([LINUX_CONFIG_COMPAT], AC_MSG_RESULT(no) ]) - AC_MSG_CHECKING([if mm.h has kvfree]) - LB_LINUX_TRY_COMPILE([ - #include - ],[ - kvfree(NULL); - - return 0; - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_KVFREE, 1, - [kvfree is defined]) - ],[ - AC_MSG_RESULT(no) - ]) - AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any]) LB_LINUX_TRY_COMPILE([ #include diff --git a/include/linux/compat-3.15.h b/include/linux/compat-3.15.h new file mode 100644 index 0000000..bb7ec03 --- /dev/null +++ b/include/linux/compat-3.15.h @@ -0,0 +1,13 @@ +#ifndef LINUX_3_15_COMPAT_H +#define LINUX_3_15_COMPAT_H + +#include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) + +#define kvfree LINUX_BACKPORT(kvfree) +extern void kvfree(const void *addr); + +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) */ + +#endif /* LINUX_3_15_COMPAT_H */ -- 2.41.0