Blame view

net/sunrpc/sunrpc_syms.c 2.65 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
  /*
   * linux/net/sunrpc/sunrpc_syms.c
   *
   * Symbols exported by the sunrpc module.
   *
   * Copyright (C) 1997 Olaf Kirch <okir@monad.swb.de>
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
  #include <linux/module.h>
  
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
12
13
14
15
16
17
18
19
20
21
  #include <linux/uio.h>
  #include <linux/unistd.h>
  #include <linux/init.h>
  
  #include <linux/sunrpc/sched.h>
  #include <linux/sunrpc/clnt.h>
  #include <linux/sunrpc/svc.h>
  #include <linux/sunrpc/svcsock.h>
  #include <linux/sunrpc/auth.h>
  #include <linux/workqueue.h>
  #include <linux/sunrpc/rpc_pipe_fs.h>
49c36fcc4   \"Talpey, Thomas\   SUNRPC: rearrange...
22
  #include <linux/sunrpc/xprtsock.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23

2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
24
  #include "netns.h"
c7d03a00b   Alexey Dobriyan   netns: make struc...
25
  unsigned int sunrpc_net_id;
a1db410d0   Stanislav Kinsbursky   SUNRPC: create GS...
26
  EXPORT_SYMBOL_GPL(sunrpc_net_id);
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
27
28
29
  
  static __net_init int sunrpc_init_net(struct net *net)
  {
4f42d0d53   Pavel Emelyanov   sunrpc: Make the ...
30
  	int err;
70abc49b4   Stanislav Kinsbursky   SUNRPC: make SUNP...
31
  	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
4f42d0d53   Pavel Emelyanov   sunrpc: Make the ...
32
33
34
35
  
  	err = rpc_proc_init(net);
  	if (err)
  		goto err_proc;
90d51b02f   Pavel Emelyanov   sunrpc: Make the ...
36
37
38
  	err = ip_map_cache_create(net);
  	if (err)
  		goto err_ipmap;
73393232d   Stanislav Kinsbursky   SUNRPC: create un...
39
40
41
  	err = unix_gid_cache_create(net);
  	if (err)
  		goto err_unixgid;
4b9a445e3   Jeff Layton   sunrpc: create a ...
42
43
44
  	err = rpc_pipefs_init_net(net);
  	if (err)
  		goto err_pipefs;
70abc49b4   Stanislav Kinsbursky   SUNRPC: make SUNP...
45
46
  	INIT_LIST_HEAD(&sn->all_clients);
  	spin_lock_init(&sn->rpc_client_lock);
1d96e80fa   Stanislav Kinsbursky   SUNRPC: init per-...
47
  	spin_lock_init(&sn->rpcb_clnt_lock);
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
48
  	return 0;
4f42d0d53   Pavel Emelyanov   sunrpc: Make the ...
49

4b9a445e3   Jeff Layton   sunrpc: create a ...
50
51
  err_pipefs:
  	unix_gid_cache_destroy(net);
73393232d   Stanislav Kinsbursky   SUNRPC: create un...
52
53
  err_unixgid:
  	ip_map_cache_destroy(net);
90d51b02f   Pavel Emelyanov   sunrpc: Make the ...
54
55
  err_ipmap:
  	rpc_proc_exit(net);
4f42d0d53   Pavel Emelyanov   sunrpc: Make the ...
56
57
  err_proc:
  	return err;
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
58
59
60
61
  }
  
  static __net_exit void sunrpc_exit_net(struct net *net)
  {
4b9a445e3   Jeff Layton   sunrpc: create a ...
62
  	rpc_pipefs_exit_net(net);
73393232d   Stanislav Kinsbursky   SUNRPC: create un...
63
  	unix_gid_cache_destroy(net);
90d51b02f   Pavel Emelyanov   sunrpc: Make the ...
64
  	ip_map_cache_destroy(net);
4f42d0d53   Pavel Emelyanov   sunrpc: Make the ...
65
  	rpc_proc_exit(net);
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
66
67
68
69
70
71
72
73
  }
  
  static struct pernet_operations sunrpc_net_ops = {
  	.init = sunrpc_init_net,
  	.exit = sunrpc_exit_net,
  	.id = &sunrpc_net_id,
  	.size = sizeof(struct sunrpc_net),
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
  static int __init
  init_sunrpc(void)
  {
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
77
  	int err = rpc_init_mempool();
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
  	if (err)
  		goto out;
5d8d9a4d9   Trond Myklebust   NFS: Ensure the A...
80
81
  	err = rpcauth_init_module();
  	if (err)
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
82
  		goto out2;
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
83
84
85
86
87
  
  	cache_initialize();
  
  	err = register_pernet_subsys(&sunrpc_net_ops);
  	if (err)
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
88
89
90
91
  		goto out3;
  
  	err = register_rpc_pipefs();
  	if (err)
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
92
  		goto out4;
b4b9d2ccf   Jeff Layton   sunrpc: add debug...
93

f9c72d10d   Jeff Layton   sunrpc: make debu...
94
  	sunrpc_debugfs_init();
f895b252d   Jeff Layton   sunrpc: eliminate...
95
  #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
  	rpc_register_sysctl();
  #endif
360d87386   Tom Tucker   svc: Make svc_soc...
98
99
  	svc_init_xprt_sock();	/* svc sock transport */
  	init_socket_xprt();	/* clnt sock transport */
5d8d9a4d9   Trond Myklebust   NFS: Ensure the A...
100
  	return 0;
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
101
102
  
  out4:
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
103
  	unregister_pernet_subsys(&sunrpc_net_ops);
5d8d9a4d9   Trond Myklebust   NFS: Ensure the A...
104
  out3:
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
105
  	rpcauth_remove_module();
5d8d9a4d9   Trond Myklebust   NFS: Ensure the A...
106
  out2:
adae0fe0e   Stanislav Kinsbursky   SUNRPC: register ...
107
  	rpc_destroy_mempool();
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
111
112
113
114
  out:
  	return err;
  }
  
  static void __exit
  cleanup_sunrpc(void)
  {
c929ea0b9   Kinglong Mee   SUNRPC: cleanup i...
115
  	rpc_cleanup_clids();
f5c2187cf   Trond Myklebust   SUNRPC: Convert t...
116
  	rpcauth_remove_module();
282b32e17   Chuck Lever   SUNRPC: create st...
117
  	cleanup_socket_xprt();
360d87386   Tom Tucker   svc: Make svc_soc...
118
  	svc_cleanup_xprt_sock();
b4b9d2ccf   Jeff Layton   sunrpc: add debug...
119
  	sunrpc_debugfs_exit();
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
120
121
  	unregister_rpc_pipefs();
  	rpc_destroy_mempool();
2f72c9b73   Pavel Emelyanov   sunrpc: The per-n...
122
  	unregister_pernet_subsys(&sunrpc_net_ops);
f895b252d   Jeff Layton   sunrpc: eliminate...
123
  #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
125
  	rpc_unregister_sysctl();
  #endif
75de874f5   Jesper Dangaard Brouer   sunrpc: Use rcu_b...
126
  	rcu_barrier(); /* Wait for completion of call_rcu()'s */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
128
  }
  MODULE_LICENSE("GPL");
405d8f8b1   Trond Myklebust   SUNRPC: Ensure th...
129
  fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
130
  module_exit(cleanup_sunrpc);