[patch 08/10][NETNS][IP6_FIB] dynamically allocate the gc timer
Daniel Lezcano
dlezcano at fr.ibm.com
Thu Nov 15 06:01:51 PST 2007
The gc timer is dynamically allocated and initialized in
the ip6 fib init function. There are no more references to a
static global variable.
Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery at bull.net>
---
net/ipv6/ip6_fib.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Index: linux-2.6-netns/net/ipv6/ip6_fib.c
===================================================================
--- linux-2.6-netns.orig/net/ipv6/ip6_fib.c
+++ linux-2.6-netns/net/ipv6/ip6_fib.c
@@ -93,10 +93,7 @@ static int fib6_walk_continue(struct fib
static __u32 rt_sernum;
-static void fib6_gc_timer_cb(unsigned long arg);
-
-static DEFINE_TIMER(__ip6_fib_timer, fib6_gc_timer_cb, 0, (unsigned long)&init_net);
-static struct timer_list *ip6_fib_timer = &__ip6_fib_timer;
+static struct timer_list *ip6_fib_timer;
static struct fib6_walker_t fib6_walker_list = {
.prev = &fib6_walker_list,
@@ -1528,6 +1525,15 @@ void __init fib6_init(void)
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL);
+ ip6_fib_timer = kzalloc(sizeof(*ip6_fib_timer), GFP_KERNEL);
+ if (!ip6_fib_timer)
+ panic("IPV6: failed to allocate the gc timer\n");
+
+ ip6_fib_timer->function = fib6_gc_timer_cb;
+ ip6_fib_timer->expires = 0;
+ ip6_fib_timer->data = (unsigned long)&init_net;
+ ip6_fib_timer->base = &boot_tvec_bases;
+
register_pernet_subsys(&fib6_net_ops);
__rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
}
@@ -1535,6 +1541,7 @@ void __init fib6_init(void)
void fib6_gc_cleanup(void)
{
del_timer(ip6_fib_timer);
+ kfree(ip6_fib_timer);
unregister_pernet_subsys(&fib6_net_ops);
kmem_cache_destroy(fib6_node_kmem);
}
--
More information about the Containers
mailing list