sunrpc_syms.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * linux/net/sunrpc/sunrpc_syms.c
  3. *
  4. * Symbols exported by the sunrpc module.
  5. *
  6. * Copyright (C) 1997 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #include <linux/module.h>
  9. #include <linux/types.h>
  10. #include <linux/uio.h>
  11. #include <linux/unistd.h>
  12. #include <linux/init.h>
  13. #include <linux/sunrpc/sched.h>
  14. #include <linux/sunrpc/clnt.h>
  15. #include <linux/sunrpc/svc.h>
  16. #include <linux/sunrpc/svcsock.h>
  17. #include <linux/sunrpc/auth.h>
  18. #include <linux/workqueue.h>
  19. #include <linux/sunrpc/rpc_pipe_fs.h>
  20. #include <linux/sunrpc/xprtsock.h>
  21. #include "netns.h"
  22. int sunrpc_net_id;
  23. EXPORT_SYMBOL_GPL(sunrpc_net_id);
  24. static __net_init int sunrpc_init_net(struct net *net)
  25. {
  26. int err;
  27. struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
  28. err = rpc_proc_init(net);
  29. if (err)
  30. goto err_proc;
  31. err = ip_map_cache_create(net);
  32. if (err)
  33. goto err_ipmap;
  34. err = unix_gid_cache_create(net);
  35. if (err)
  36. goto err_unixgid;
  37. rpc_pipefs_init_net(net);
  38. INIT_LIST_HEAD(&sn->all_clients);
  39. spin_lock_init(&sn->rpc_client_lock);
  40. spin_lock_init(&sn->rpcb_clnt_lock);
  41. return 0;
  42. err_unixgid:
  43. ip_map_cache_destroy(net);
  44. err_ipmap:
  45. rpc_proc_exit(net);
  46. err_proc:
  47. return err;
  48. }
  49. static __net_exit void sunrpc_exit_net(struct net *net)
  50. {
  51. unix_gid_cache_destroy(net);
  52. ip_map_cache_destroy(net);
  53. rpc_proc_exit(net);
  54. }
  55. static struct pernet_operations sunrpc_net_ops = {
  56. .init = sunrpc_init_net,
  57. .exit = sunrpc_exit_net,
  58. .id = &sunrpc_net_id,
  59. .size = sizeof(struct sunrpc_net),
  60. };
  61. static int __init
  62. init_sunrpc(void)
  63. {
  64. int err = rpc_init_mempool();
  65. if (err)
  66. goto out;
  67. err = rpcauth_init_module();
  68. if (err)
  69. goto out2;
  70. cache_initialize();
  71. err = register_pernet_subsys(&sunrpc_net_ops);
  72. if (err)
  73. goto out3;
  74. err = register_rpc_pipefs();
  75. if (err)
  76. goto out4;
  77. #ifdef RPC_DEBUG
  78. rpc_register_sysctl();
  79. #endif
  80. svc_init_xprt_sock(); /* svc sock transport */
  81. init_socket_xprt(); /* clnt sock transport */
  82. return 0;
  83. out4:
  84. unregister_pernet_subsys(&sunrpc_net_ops);
  85. out3:
  86. rpcauth_remove_module();
  87. out2:
  88. rpc_destroy_mempool();
  89. out:
  90. return err;
  91. }
  92. static void __exit
  93. cleanup_sunrpc(void)
  94. {
  95. rpcauth_remove_module();
  96. cleanup_socket_xprt();
  97. svc_cleanup_xprt_sock();
  98. unregister_rpc_pipefs();
  99. rpc_destroy_mempool();
  100. unregister_pernet_subsys(&sunrpc_net_ops);
  101. #ifdef RPC_DEBUG
  102. rpc_unregister_sysctl();
  103. #endif
  104. rcu_barrier(); /* Wait for completion of call_rcu()'s */
  105. }
  106. MODULE_LICENSE("GPL");
  107. fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */
  108. module_exit(cleanup_sunrpc);