11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * linux/net/sunrpc/sunrpc_syms.c 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Symbols exported by the sunrpc module. 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * Copyright (C) 1997 Olaf Kirch <okir@monad.swb.de> 71da177e4SLinus Torvalds */ 81da177e4SLinus Torvalds 91da177e4SLinus Torvalds #include <linux/module.h> 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds #include <linux/types.h> 121da177e4SLinus Torvalds #include <linux/uio.h> 131da177e4SLinus Torvalds #include <linux/unistd.h> 141da177e4SLinus Torvalds #include <linux/init.h> 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds #include <linux/sunrpc/sched.h> 171da177e4SLinus Torvalds #include <linux/sunrpc/clnt.h> 181da177e4SLinus Torvalds #include <linux/sunrpc/svc.h> 191da177e4SLinus Torvalds #include <linux/sunrpc/svcsock.h> 201da177e4SLinus Torvalds #include <linux/sunrpc/auth.h> 211da177e4SLinus Torvalds #include <linux/workqueue.h> 221da177e4SLinus Torvalds #include <linux/sunrpc/rpc_pipe_fs.h> 2349c36fccS\"Talpey, Thomas\ #include <linux/sunrpc/xprtsock.h> 241da177e4SLinus Torvalds 252f72c9b7SPavel Emelyanov #include "netns.h" 262f72c9b7SPavel Emelyanov 272f72c9b7SPavel Emelyanov int sunrpc_net_id; 28a1db410dSStanislav Kinsbursky EXPORT_SYMBOL_GPL(sunrpc_net_id); 292f72c9b7SPavel Emelyanov 3073393232SStanislav Kinsbursky extern int unix_gid_cache_create(struct net *net); 3173393232SStanislav Kinsbursky extern int unix_gid_cache_destroy(struct net *net); 3273393232SStanislav Kinsbursky 332f72c9b7SPavel Emelyanov static __net_init int sunrpc_init_net(struct net *net) 342f72c9b7SPavel Emelyanov { 354f42d0d5SPavel Emelyanov int err; 3670abc49bSStanislav Kinsbursky struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 374f42d0d5SPavel Emelyanov 384f42d0d5SPavel Emelyanov err = rpc_proc_init(net); 394f42d0d5SPavel Emelyanov if (err) 404f42d0d5SPavel Emelyanov goto err_proc; 414f42d0d5SPavel Emelyanov 4290d51b02SPavel Emelyanov err = ip_map_cache_create(net); 4390d51b02SPavel Emelyanov if (err) 4490d51b02SPavel Emelyanov goto err_ipmap; 4590d51b02SPavel Emelyanov 4673393232SStanislav Kinsbursky err = unix_gid_cache_create(net); 4773393232SStanislav Kinsbursky if (err) 4873393232SStanislav Kinsbursky goto err_unixgid; 4973393232SStanislav Kinsbursky 50c21a588fSStanislav Kinsbursky rpc_pipefs_init_net(net); 5170abc49bSStanislav Kinsbursky INIT_LIST_HEAD(&sn->all_clients); 5270abc49bSStanislav Kinsbursky spin_lock_init(&sn->rpc_client_lock); 531d96e80fSStanislav Kinsbursky spin_lock_init(&sn->rpcb_clnt_lock); 542f72c9b7SPavel Emelyanov return 0; 554f42d0d5SPavel Emelyanov 5673393232SStanislav Kinsbursky err_unixgid: 5773393232SStanislav Kinsbursky ip_map_cache_destroy(net); 5890d51b02SPavel Emelyanov err_ipmap: 5990d51b02SPavel Emelyanov rpc_proc_exit(net); 604f42d0d5SPavel Emelyanov err_proc: 614f42d0d5SPavel Emelyanov return err; 622f72c9b7SPavel Emelyanov } 632f72c9b7SPavel Emelyanov 642f72c9b7SPavel Emelyanov static __net_exit void sunrpc_exit_net(struct net *net) 652f72c9b7SPavel Emelyanov { 6673393232SStanislav Kinsbursky unix_gid_cache_destroy(net); 6790d51b02SPavel Emelyanov ip_map_cache_destroy(net); 684f42d0d5SPavel Emelyanov rpc_proc_exit(net); 692f72c9b7SPavel Emelyanov } 702f72c9b7SPavel Emelyanov 712f72c9b7SPavel Emelyanov static struct pernet_operations sunrpc_net_ops = { 722f72c9b7SPavel Emelyanov .init = sunrpc_init_net, 732f72c9b7SPavel Emelyanov .exit = sunrpc_exit_net, 742f72c9b7SPavel Emelyanov .id = &sunrpc_net_id, 752f72c9b7SPavel Emelyanov .size = sizeof(struct sunrpc_net), 762f72c9b7SPavel Emelyanov }; 772f72c9b7SPavel Emelyanov 781da177e4SLinus Torvalds static int __init 791da177e4SLinus Torvalds init_sunrpc(void) 801da177e4SLinus Torvalds { 811da177e4SLinus Torvalds int err = register_rpc_pipefs(); 821da177e4SLinus Torvalds if (err) 831da177e4SLinus Torvalds goto out; 845bd5f581SAkinobu Mita err = rpc_init_mempool(); 855d8d9a4dSTrond Myklebust if (err) 865d8d9a4dSTrond Myklebust goto out2; 875d8d9a4dSTrond Myklebust err = rpcauth_init_module(); 885d8d9a4dSTrond Myklebust if (err) 895d8d9a4dSTrond Myklebust goto out3; 902f72c9b7SPavel Emelyanov 912f72c9b7SPavel Emelyanov cache_initialize(); 922f72c9b7SPavel Emelyanov 932f72c9b7SPavel Emelyanov err = register_pernet_subsys(&sunrpc_net_ops); 942f72c9b7SPavel Emelyanov if (err) 952f72c9b7SPavel Emelyanov goto out4; 961da177e4SLinus Torvalds #ifdef RPC_DEBUG 971da177e4SLinus Torvalds rpc_register_sysctl(); 981da177e4SLinus Torvalds #endif 99360d8738STom Tucker svc_init_xprt_sock(); /* svc sock transport */ 100360d8738STom Tucker init_socket_xprt(); /* clnt sock transport */ 1015d8d9a4dSTrond Myklebust return 0; 1022f72c9b7SPavel Emelyanov 1032f72c9b7SPavel Emelyanov out4: 1042f72c9b7SPavel Emelyanov rpcauth_remove_module(); 1055d8d9a4dSTrond Myklebust out3: 1065d8d9a4dSTrond Myklebust rpc_destroy_mempool(); 1075d8d9a4dSTrond Myklebust out2: 1085d8d9a4dSTrond Myklebust unregister_rpc_pipefs(); 1091da177e4SLinus Torvalds out: 1101da177e4SLinus Torvalds return err; 1111da177e4SLinus Torvalds } 1121da177e4SLinus Torvalds 1131da177e4SLinus Torvalds static void __exit 1141da177e4SLinus Torvalds cleanup_sunrpc(void) 1151da177e4SLinus Torvalds { 116f5c2187cSTrond Myklebust rpcauth_remove_module(); 117282b32e1SChuck Lever cleanup_socket_xprt(); 118360d8738STom Tucker svc_cleanup_xprt_sock(); 1191da177e4SLinus Torvalds unregister_rpc_pipefs(); 1201da177e4SLinus Torvalds rpc_destroy_mempool(); 1212f72c9b7SPavel Emelyanov unregister_pernet_subsys(&sunrpc_net_ops); 1221da177e4SLinus Torvalds #ifdef RPC_DEBUG 1231da177e4SLinus Torvalds rpc_unregister_sysctl(); 1241da177e4SLinus Torvalds #endif 12575de874fSJesper Dangaard Brouer rcu_barrier(); /* Wait for completion of call_rcu()'s */ 1261da177e4SLinus Torvalds } 1271da177e4SLinus Torvalds MODULE_LICENSE("GPL"); 128405d8f8bSTrond Myklebust fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */ 1291da177e4SLinus Torvalds module_exit(cleanup_sunrpc); 130