提交 61a02653 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

[NETNS]: Add namespace to API for routing /proc entries creation.

This adds netns parameter to fib_proc_init/exit and replaces __init
specifier with __net_init. After this, we will not yet have these proc
files show info from the specific namespace - this will be done when
these tables become namespaced.
Acked-by: NBenjamin Thery <benjamin.thery@bull.net>
Acked-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: NDenis V. Lunev <den@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5fd30ee7
...@@ -253,8 +253,8 @@ static inline void fib_res_put(struct fib_result *res) ...@@ -253,8 +253,8 @@ static inline void fib_res_put(struct fib_result *res)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
extern int fib_proc_init(void); extern int __net_init fib_proc_init(struct net *net);
extern void fib_proc_exit(void); extern void __net_exit fib_proc_exit(struct net *net);
#endif #endif
#endif /* _NET_FIB_H */ #endif /* _NET_FIB_H */
...@@ -1475,14 +1475,14 @@ static int __init ipv4_proc_init(void) ...@@ -1475,14 +1475,14 @@ static int __init ipv4_proc_init(void)
goto out_tcp; goto out_tcp;
if (udp4_proc_init()) if (udp4_proc_init())
goto out_udp; goto out_udp;
if (fib_proc_init()) if (fib_proc_init(&init_net))
goto out_fib; goto out_fib;
if (ip_misc_proc_init()) if (ip_misc_proc_init())
goto out_misc; goto out_misc;
out: out:
return rc; return rc;
out_misc: out_misc:
fib_proc_exit(); fib_proc_exit(&init_net);
out_fib: out_fib:
udp4_proc_exit(); udp4_proc_exit();
out_udp: out_udp:
......
...@@ -1041,15 +1041,15 @@ static const struct file_operations fib_seq_fops = { ...@@ -1041,15 +1041,15 @@ static const struct file_operations fib_seq_fops = {
.release = seq_release_private, .release = seq_release_private,
}; };
int __init fib_proc_init(void) int __net_init fib_proc_init(struct net *net)
{ {
if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_seq_fops)) if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_seq_fops))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
void __init fib_proc_exit(void) void __net_exit fib_proc_exit(struct net *net)
{ {
proc_net_remove(&init_net, "route"); proc_net_remove(net, "route");
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
...@@ -2508,32 +2508,33 @@ static const struct file_operations fib_route_fops = { ...@@ -2508,32 +2508,33 @@ static const struct file_operations fib_route_fops = {
.release = seq_release_private, .release = seq_release_private,
}; };
int __init fib_proc_init(void) int __net_init fib_proc_init(struct net *net)
{ {
if (!proc_net_fops_create(&init_net, "fib_trie", S_IRUGO, &fib_trie_fops)) if (!proc_net_fops_create(net, "fib_trie", S_IRUGO, &fib_trie_fops))
goto out1; goto out1;
if (!proc_net_fops_create(&init_net, "fib_triestat", S_IRUGO, &fib_triestat_fops)) if (!proc_net_fops_create(net, "fib_triestat", S_IRUGO,
&fib_triestat_fops))
goto out2; goto out2;
if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_route_fops)) if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_route_fops))
goto out3; goto out3;
return 0; return 0;
out3: out3:
proc_net_remove(&init_net, "fib_triestat"); proc_net_remove(net, "fib_triestat");
out2: out2:
proc_net_remove(&init_net, "fib_trie"); proc_net_remove(net, "fib_trie");
out1: out1:
return -ENOMEM; return -ENOMEM;
} }
void __init fib_proc_exit(void) void __net_exit fib_proc_exit(struct net *net)
{ {
proc_net_remove(&init_net, "fib_trie"); proc_net_remove(net, "fib_trie");
proc_net_remove(&init_net, "fib_triestat"); proc_net_remove(net, "fib_triestat");
proc_net_remove(&init_net, "route"); proc_net_remove(net, "route");
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册