sunrpc_syms.c 2.5 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. extern int unix_gid_cache_create(struct net *net);
  25. extern int unix_gid_cache_destroy(struct net *net);
  26. static __net_init int sunrpc_init_net(struct net *net)
  27. {
  28. int err;
  29. struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
  30. err = rpc_proc_init(net);
  31. if (err)
  32. goto err_proc;
  33. err = ip_map_cache_create(net);
  34. if (err)
  35. goto err_ipmap;
  36. err = unix_gid_cache_create(net);
  37. if (err)
  38. goto err_unixgid;
  39. rpc_pipefs_init_net(net);
  40. INIT_LIST_HEAD(&sn->all_clients);
  41. spin_lock_init(&sn->rpc_client_lock);
  42. return 0;
  43. err_unixgid:
  44. ip_map_cache_destroy(net);
  45. err_ipmap:
  46. rpc_proc_exit(net);
  47. err_proc:
  48. return err;
  49. }
  50. static __net_exit void sunrpc_exit_net(struct net *net)
  51. {
  52. unix_gid_cache_destroy(net);
  53. ip_map_cache_destroy(net);
  54. rpc_proc_exit(net);
  55. }
  56. static struct pernet_operations sunrpc_net_ops = {
  57. .init = sunrpc_init_net,
  58. .exit = sunrpc_exit_net,
  59. .id = &sunrpc_net_id,
  60. .size = sizeof(struct sunrpc_net),
  61. };
  62. static int __init
  63. init_sunrpc(void)
  64. {
  65. int err = register_rpc_pipefs();
  66. if (err)
  67. goto out;
  68. err = rpc_init_mempool();
  69. if (err)
  70. goto out2;
  71. err = rpcauth_init_module();
  72. if (err)
  73. goto out3;
  74. cache_initialize();
  75. err = register_pernet_subsys(&sunrpc_net_ops);
  76. if (err)
  77. goto out4;
  78. #ifdef RPC_DEBUG
  79. rpc_register_sysctl();
  80. #endif
  81. svc_init_xprt_sock(); /* svc sock transport */
  82. init_socket_xprt(); /* clnt sock transport */
  83. return 0;
  84. out4:
  85. rpcauth_remove_module();
  86. out3:
  87. rpc_destroy_mempool();
  88. out2:
  89. unregister_rpc_pipefs();
  90. out:
  91. return err;
  92. }
  93. static void __exit
  94. cleanup_sunrpc(void)
  95. {
  96. rpcauth_remove_module();
  97. cleanup_socket_xprt();
  98. svc_cleanup_xprt_sock();
  99. unregister_rpc_pipefs();
  100. rpc_destroy_mempool();
  101. unregister_pernet_subsys(&sunrpc_net_ops);
  102. #ifdef RPC_DEBUG
  103. rpc_unregister_sysctl();
  104. #endif
  105. rcu_barrier(); /* Wait for completion of call_rcu()'s */
  106. }
  107. MODULE_LICENSE("GPL");
  108. fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */
  109. module_exit(cleanup_sunrpc);