aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2010-09-27 06:01:27 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-09-27 10:16:12 -0400
commit2f72c9b73730c335381b13e2bd221abe1acea394 (patch)
treec8b59e83724b665bfa4d5776ba4f734f32451858 /net
parent4fb8518bdac8e85f6580ea3f586adf396cd472bc (diff)
sunrpc: The per-net skeleton
Register empty per-net operations for the sunrpc layer. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/netns.h12
-rw-r--r--net/sunrpc/sunrpc_syms.c31
2 files changed, 42 insertions, 1 deletions
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
new file mode 100644
index 000000000000..b2d18af2815e
--- /dev/null
+++ b/net/sunrpc/netns.h
@@ -0,0 +1,12 @@
1#ifndef __SUNRPC_NETNS_H__
2#define __SUNRPC_NETNS_H__
3
4#include <net/net_namespace.h>
5#include <net/netns/generic.h>
6
7struct sunrpc_net {
8};
9
10extern int sunrpc_net_id;
11
12#endif
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c0d085013a2b..faa23229bd25 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -22,6 +22,26 @@
22#include <linux/sunrpc/rpc_pipe_fs.h> 22#include <linux/sunrpc/rpc_pipe_fs.h>
23#include <linux/sunrpc/xprtsock.h> 23#include <linux/sunrpc/xprtsock.h>
24 24
25#include "netns.h"
26
27int sunrpc_net_id;
28
29static __net_init int sunrpc_init_net(struct net *net)
30{
31 return 0;
32}
33
34static __net_exit void sunrpc_exit_net(struct net *net)
35{
36}
37
38static struct pernet_operations sunrpc_net_ops = {
39 .init = sunrpc_init_net,
40 .exit = sunrpc_exit_net,
41 .id = &sunrpc_net_id,
42 .size = sizeof(struct sunrpc_net),
43};
44
25extern struct cache_detail ip_map_cache, unix_gid_cache; 45extern struct cache_detail ip_map_cache, unix_gid_cache;
26 46
27extern void cleanup_rpcb_clnt(void); 47extern void cleanup_rpcb_clnt(void);
@@ -38,18 +58,26 @@ init_sunrpc(void)
38 err = rpcauth_init_module(); 58 err = rpcauth_init_module();
39 if (err) 59 if (err)
40 goto out3; 60 goto out3;
61
62 cache_initialize();
63
64 err = register_pernet_subsys(&sunrpc_net_ops);
65 if (err)
66 goto out4;
41#ifdef RPC_DEBUG 67#ifdef RPC_DEBUG
42 rpc_register_sysctl(); 68 rpc_register_sysctl();
43#endif 69#endif
44#ifdef CONFIG_PROC_FS 70#ifdef CONFIG_PROC_FS
45 rpc_proc_init(); 71 rpc_proc_init();
46#endif 72#endif
47 cache_initialize();
48 cache_register(&ip_map_cache); 73 cache_register(&ip_map_cache);
49 cache_register(&unix_gid_cache); 74 cache_register(&unix_gid_cache);
50 svc_init_xprt_sock(); /* svc sock transport */ 75 svc_init_xprt_sock(); /* svc sock transport */
51 init_socket_xprt(); /* clnt sock transport */ 76 init_socket_xprt(); /* clnt sock transport */
52 return 0; 77 return 0;
78
79out4:
80 rpcauth_remove_module();
53out3: 81out3:
54 rpc_destroy_mempool(); 82 rpc_destroy_mempool();
55out2: 83out2:
@@ -69,6 +97,7 @@ cleanup_sunrpc(void)
69 rpc_destroy_mempool(); 97 rpc_destroy_mempool();
70 cache_unregister(&ip_map_cache); 98 cache_unregister(&ip_map_cache);
71 cache_unregister(&unix_gid_cache); 99 cache_unregister(&unix_gid_cache);
100 unregister_pernet_subsys(&sunrpc_net_ops);
72#ifdef RPC_DEBUG 101#ifdef RPC_DEBUG
73 rpc_unregister_sysctl(); 102 rpc_unregister_sysctl();
74#endif 103#endif