diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-02-18 03:13:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-18 17:30:17 -0500 |
commit | bbef49daca35d4fd21bf606a10b6980f17d9df5d (patch) | |
tree | 44b7df91941c3266286b8046890ddc7c0dfa26ec | |
parent | bc417d99bf279f034474bc2d7dedd390838a5480 (diff) |
ipv6: use standard lists for FIB walks
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip6_fib.h | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 17 |
2 files changed, 5 insertions, 14 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 8f279ddb3593..86f46c49e318 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -124,7 +124,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | struct fib6_walker_t { | 126 | struct fib6_walker_t { |
127 | struct fib6_walker_t *prev, *next; | 127 | struct list_head lh; |
128 | struct fib6_node *root, *node; | 128 | struct fib6_node *root, *node; |
129 | struct rt6_info *leaf; | 129 | struct rt6_info *leaf; |
130 | unsigned char state; | 130 | unsigned char state; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 77e122f53ea6..2f9847924fa5 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -93,29 +93,20 @@ static __u32 rt_sernum; | |||
93 | 93 | ||
94 | static void fib6_gc_timer_cb(unsigned long arg); | 94 | static void fib6_gc_timer_cb(unsigned long arg); |
95 | 95 | ||
96 | static struct fib6_walker_t fib6_walker_list = { | 96 | static LIST_HEAD(fib6_walkers); |
97 | .prev = &fib6_walker_list, | 97 | #define FOR_WALKERS(w) list_for_each_entry(w, &fib6_walkers, lh) |
98 | .next = &fib6_walker_list, | ||
99 | }; | ||
100 | |||
101 | #define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next) | ||
102 | 98 | ||
103 | static inline void fib6_walker_link(struct fib6_walker_t *w) | 99 | static inline void fib6_walker_link(struct fib6_walker_t *w) |
104 | { | 100 | { |
105 | write_lock_bh(&fib6_walker_lock); | 101 | write_lock_bh(&fib6_walker_lock); |
106 | w->next = fib6_walker_list.next; | 102 | list_add(&w->lh, &fib6_walkers); |
107 | w->prev = &fib6_walker_list; | ||
108 | w->next->prev = w; | ||
109 | w->prev->next = w; | ||
110 | write_unlock_bh(&fib6_walker_lock); | 103 | write_unlock_bh(&fib6_walker_lock); |
111 | } | 104 | } |
112 | 105 | ||
113 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) | 106 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) |
114 | { | 107 | { |
115 | write_lock_bh(&fib6_walker_lock); | 108 | write_lock_bh(&fib6_walker_lock); |
116 | w->next->prev = w->prev; | 109 | list_del(&w->lh); |
117 | w->prev->next = w->next; | ||
118 | w->prev = w->next = w; | ||
119 | write_unlock_bh(&fib6_walker_lock); | 110 | write_unlock_bh(&fib6_walker_lock); |
120 | } | 111 | } |
121 | static __inline__ u32 fib6_new_sernum(void) | 112 | static __inline__ u32 fib6_new_sernum(void) |