[1/4] batman-adv: Add compatibility code for kfree_rcu

Message ID 1305011821-5411-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 903ca657752d1aeaf99ef3ce676650308526526e
Headers

Commit Message

Sven Eckelmann May 10, 2011, 7:16 a.m. UTC
  Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Rebased on top of current master + newest version from Paul E. McKenney

 compat.c |   28 ++++++++++++++++++++++++++++
 compat.h |   10 ++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
  

Comments

Sven Eckelmann May 20, 2011, 12:27 p.m. UTC | #1
Sven Eckelmann wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> Rebased on top of current master + newest version from Paul E. McKenney

Applied in 903ca65
  

Patch

diff --git a/compat.c b/compat.c
index 586898f..e040486 100644
--- a/compat.c
+++ b/compat.c
@@ -988,3 +988,31 @@  int bat_seq_printf(struct seq_file *m, const char *f, ...)
 }
 
 #endif /* < KERNEL_VERSION(2, 6, 29) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 40)
+
+void free_rcu_gw_node(struct rcu_head *rcu)
+{
+	struct gw_node *gw_node;
+
+	gw_node = container_of(rcu, struct gw_node, rcu);
+	kfree(gw_node);
+}
+
+void free_rcu_neigh_node(struct rcu_head *rcu)
+{
+	struct neigh_node *neigh_node;
+
+	neigh_node = container_of(rcu, struct neigh_node, rcu);
+	kfree(neigh_node);
+}
+
+void free_rcu_softif_neigh(struct rcu_head *rcu)
+{
+	struct softif_neigh *softif_neigh;
+
+	softif_neigh = container_of(rcu, struct softif_neigh, rcu);
+	kfree(softif_neigh);
+}
+
+#endif /* < KERNEL_VERSION(2, 6, 40) */
diff --git a/compat.h b/compat.h
index fb49f9d..2e3f062 100644
--- a/compat.h
+++ b/compat.h
@@ -273,4 +273,14 @@  int bat_seq_printf(struct seq_file *m, const char *f, ...);
 
 #endif /* < KERNEL_VERSION(2, 6, 36) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 40)
+
+#define kfree_rcu(ptr, rcu_head) call_rcu(&ptr->rcu_head, free_rcu_##ptr)
+
+void free_rcu_gw_node(struct rcu_head *rcu);
+void free_rcu_neigh_node(struct rcu_head *rcu);
+void free_rcu_softif_neigh(struct rcu_head *rcu);
+
+#endif /* < KERNEL_VERSION(2, 6, 40) */
+
 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */