diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 13:36:06 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 15:39:56 -0400 |
commit | 1218854afa6f659be90b748cf1bc7badee954a35 (patch) | |
tree | 78b83e3941fa7e5a03c04e2e4f6ddb1a08ea38a0 /net/ipv4 | |
parent | 3b1e0a655f8eba44ab1ee2a1068d169ccfb853b9 (diff) |
[NET] NETNS: Omit seq_net_private->net without CONFIG_NET_NS.
Without CONFIG_NET_NS, no namespace other than &init_net exists,
no need to store net in seq_net_private.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fib_hash.c | 5 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 13 | ||||
-rw-r--r-- | net/ipv4/raw.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 29 |
4 files changed, 25 insertions, 26 deletions
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 8d58d85dfac6..02088deb0461 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -821,7 +821,7 @@ static struct fib_alias *fib_get_first(struct seq_file *seq) | |||
821 | struct fib_table *main_table; | 821 | struct fib_table *main_table; |
822 | struct fn_hash *table; | 822 | struct fn_hash *table; |
823 | 823 | ||
824 | main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN); | 824 | main_table = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN); |
825 | table = (struct fn_hash *)main_table->tb_data; | 825 | table = (struct fn_hash *)main_table->tb_data; |
826 | 826 | ||
827 | iter->bucket = 0; | 827 | iter->bucket = 0; |
@@ -959,11 +959,10 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) | |||
959 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) | 959 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) |
960 | __acquires(fib_hash_lock) | 960 | __acquires(fib_hash_lock) |
961 | { | 961 | { |
962 | struct fib_iter_state *iter = seq->private; | ||
963 | void *v = NULL; | 962 | void *v = NULL; |
964 | 963 | ||
965 | read_lock(&fib_hash_lock); | 964 | read_lock(&fib_hash_lock); |
966 | if (fib_get_table(iter->p.net, RT_TABLE_MAIN)) | 965 | if (fib_get_table(seq_file_net(seq), RT_TABLE_MAIN)) |
967 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 966 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
968 | return v; | 967 | return v; |
969 | } | 968 | } |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index ce6cb34e28e1..9e491e70e855 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2279,9 +2279,10 @@ static const struct file_operations fib_triestat_fops = { | |||
2279 | .release = fib_triestat_seq_release, | 2279 | .release = fib_triestat_seq_release, |
2280 | }; | 2280 | }; |
2281 | 2281 | ||
2282 | static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos) | 2282 | static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) |
2283 | { | 2283 | { |
2284 | struct net *net = iter->p.net; | 2284 | struct fib_trie_iter *iter = seq->private; |
2285 | struct net *net = seq_file_net(seq); | ||
2285 | loff_t idx = 0; | 2286 | loff_t idx = 0; |
2286 | unsigned int h; | 2287 | unsigned int h; |
2287 | 2288 | ||
@@ -2309,16 +2310,14 @@ static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos) | |||
2309 | static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos) | 2310 | static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos) |
2310 | __acquires(RCU) | 2311 | __acquires(RCU) |
2311 | { | 2312 | { |
2312 | struct fib_trie_iter *iter = seq->private; | ||
2313 | |||
2314 | rcu_read_lock(); | 2313 | rcu_read_lock(); |
2315 | return fib_trie_get_idx(iter, *pos); | 2314 | return fib_trie_get_idx(seq, *pos); |
2316 | } | 2315 | } |
2317 | 2316 | ||
2318 | static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2317 | static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2319 | { | 2318 | { |
2320 | struct fib_trie_iter *iter = seq->private; | 2319 | struct fib_trie_iter *iter = seq->private; |
2321 | struct net *net = iter->p.net; | 2320 | struct net *net = seq_file_net(seq); |
2322 | struct fib_table *tb = iter->tb; | 2321 | struct fib_table *tb = iter->tb; |
2323 | struct hlist_node *tb_node; | 2322 | struct hlist_node *tb_node; |
2324 | unsigned int h; | 2323 | unsigned int h; |
@@ -2513,7 +2512,7 @@ static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos) | |||
2513 | struct fib_table *tb; | 2512 | struct fib_table *tb; |
2514 | 2513 | ||
2515 | rcu_read_lock(); | 2514 | rcu_read_lock(); |
2516 | tb = fib_get_table(iter->p.net, RT_TABLE_MAIN); | 2515 | tb = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN); |
2517 | if (!tb) | 2516 | if (!tb) |
2518 | return NULL; | 2517 | return NULL; |
2519 | 2518 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index be19a4048d7c..25dc8b38cac3 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -856,7 +856,7 @@ static struct sock *raw_get_first(struct seq_file *seq) | |||
856 | struct hlist_node *node; | 856 | struct hlist_node *node; |
857 | 857 | ||
858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) | 858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) |
859 | if (sock_net(sk) == state->p.net) | 859 | if (sock_net(sk) == seq_file_net(seq)) |
860 | goto found; | 860 | goto found; |
861 | } | 861 | } |
862 | sk = NULL; | 862 | sk = NULL; |
@@ -872,7 +872,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | |||
872 | sk = sk_next(sk); | 872 | sk = sk_next(sk); |
873 | try_again: | 873 | try_again: |
874 | ; | 874 | ; |
875 | } while (sk && sock_net(sk) != state->p.net); | 875 | } while (sk && sock_net(sk) != seq_file_net(seq)); |
876 | 876 | ||
877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { | 877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { |
878 | sk = sk_head(&state->h->ht[state->bucket]); | 878 | sk = sk_head(&state->h->ht[state->bucket]); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 194f5cca3121..eab8d75e5222 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -276,15 +276,16 @@ struct rt_cache_iter_state { | |||
276 | int genid; | 276 | int genid; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | 279 | static struct rtable *rt_cache_get_first(struct seq_file *seq) |
280 | { | 280 | { |
281 | struct rt_cache_iter_state *st = seq->private; | ||
281 | struct rtable *r = NULL; | 282 | struct rtable *r = NULL; |
282 | 283 | ||
283 | for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { | 284 | for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { |
284 | rcu_read_lock_bh(); | 285 | rcu_read_lock_bh(); |
285 | r = rcu_dereference(rt_hash_table[st->bucket].chain); | 286 | r = rcu_dereference(rt_hash_table[st->bucket].chain); |
286 | while (r) { | 287 | while (r) { |
287 | if (dev_net(r->u.dst.dev) == st->p.net && | 288 | if (dev_net(r->u.dst.dev) == seq_file_net(seq) && |
288 | r->rt_genid == st->genid) | 289 | r->rt_genid == st->genid) |
289 | return r; | 290 | return r; |
290 | r = rcu_dereference(r->u.dst.rt_next); | 291 | r = rcu_dereference(r->u.dst.rt_next); |
@@ -294,9 +295,10 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | |||
294 | return r; | 295 | return r; |
295 | } | 296 | } |
296 | 297 | ||
297 | static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st, | 298 | static struct rtable *__rt_cache_get_next(struct seq_file *seq, |
298 | struct rtable *r) | 299 | struct rtable *r) |
299 | { | 300 | { |
301 | struct rt_cache_iter_state *st = seq->private; | ||
300 | r = r->u.dst.rt_next; | 302 | r = r->u.dst.rt_next; |
301 | while (!r) { | 303 | while (!r) { |
302 | rcu_read_unlock_bh(); | 304 | rcu_read_unlock_bh(); |
@@ -308,11 +310,12 @@ static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st, | |||
308 | return rcu_dereference(r); | 310 | return rcu_dereference(r); |
309 | } | 311 | } |
310 | 312 | ||
311 | static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | 313 | static struct rtable *rt_cache_get_next(struct seq_file *seq, |
312 | struct rtable *r) | 314 | struct rtable *r) |
313 | { | 315 | { |
314 | while ((r = __rt_cache_get_next(st, r)) != NULL) { | 316 | struct rt_cache_iter_state *st = seq->private; |
315 | if (dev_net(r->u.dst.dev) != st->p.net) | 317 | while ((r = __rt_cache_get_next(seq, r)) != NULL) { |
318 | if (dev_net(r->u.dst.dev) != seq_file_net(seq)) | ||
316 | continue; | 319 | continue; |
317 | if (r->rt_genid == st->genid) | 320 | if (r->rt_genid == st->genid) |
318 | break; | 321 | break; |
@@ -320,12 +323,12 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | |||
320 | return r; | 323 | return r; |
321 | } | 324 | } |
322 | 325 | ||
323 | static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos) | 326 | static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) |
324 | { | 327 | { |
325 | struct rtable *r = rt_cache_get_first(st); | 328 | struct rtable *r = rt_cache_get_first(seq); |
326 | 329 | ||
327 | if (r) | 330 | if (r) |
328 | while (pos && (r = rt_cache_get_next(st, r))) | 331 | while (pos && (r = rt_cache_get_next(seq, r))) |
329 | --pos; | 332 | --pos; |
330 | return pos ? NULL : r; | 333 | return pos ? NULL : r; |
331 | } | 334 | } |
@@ -333,9 +336,8 @@ static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t po | |||
333 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 336 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |
334 | { | 337 | { |
335 | struct rt_cache_iter_state *st = seq->private; | 338 | struct rt_cache_iter_state *st = seq->private; |
336 | |||
337 | if (*pos) | 339 | if (*pos) |
338 | return rt_cache_get_idx(st, *pos - 1); | 340 | return rt_cache_get_idx(seq, *pos - 1); |
339 | st->genid = atomic_read(&rt_genid); | 341 | st->genid = atomic_read(&rt_genid); |
340 | return SEQ_START_TOKEN; | 342 | return SEQ_START_TOKEN; |
341 | } | 343 | } |
@@ -343,12 +345,11 @@ static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | |||
343 | static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 345 | static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
344 | { | 346 | { |
345 | struct rtable *r; | 347 | struct rtable *r; |
346 | struct rt_cache_iter_state *st = seq->private; | ||
347 | 348 | ||
348 | if (v == SEQ_START_TOKEN) | 349 | if (v == SEQ_START_TOKEN) |
349 | r = rt_cache_get_first(st); | 350 | r = rt_cache_get_first(seq); |
350 | else | 351 | else |
351 | r = rt_cache_get_next(st, v); | 352 | r = rt_cache_get_next(seq, v); |
352 | ++*pos; | 353 | ++*pos; |
353 | return r; | 354 | return r; |
354 | } | 355 | } |