/* * Create an RPC client * FIXME: This should also take a flags argument (as in task->tk_flags). * It's called (among others) from pmap_create_client, which may in * turn be called by an async task. In this case, rpciod should not be * made to sleep too long. */ struct rpc_clnt * rpc_create_client(struct rpc_xprt *xprt, char *servname, struct rpc_program *program, u32 vers, int flavor) { struct rpc_version *version; struct rpc_clnt *clnt = NULL; dprintk("RPC: creating %s client for %s (xprt %p)\n", program->name, servname, xprt); if (!xprt) goto out; if (vers >= program->nrvers || !(version = program->version[vers])) goto out; clnt = (struct rpc_clnt *) rpc_allocate(0, sizeof(*clnt)); if (!clnt) goto out_no_clnt; memset(clnt, 0, sizeof(*clnt)); clnt->cl_xprt = xprt; clnt->cl_procinfo = version->procs; clnt->cl_maxproc = version->nrprocs; clnt->cl_server = servname; clnt->cl_protname = program->name; clnt->cl_port = xprt->addr.sin_port; clnt->cl_prog = program->number; clnt->cl_vers = version->number; clnt->cl_prot = IPPROTO_UDP; clnt->cl_stats = program->stats; clnt->cl_bindwait = RPC_INIT_WAITQ("bindwait"); if (!clnt->cl_port) clnt->cl_autobind = 1; if (!rpcauth_create(flavor, clnt)) goto out_no_auth; /* save the nodename */ clnt->cl_nodelen = strlen(system_utsname.nodename); if (clnt->cl_nodelen > UNX_MAXNODENAME) clnt->cl_nodelen = UNX_MAXNODENAME; memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen); out: return clnt; out_no_clnt: printk("RPC: out of memory in rpc_create_client\n"); goto out; out_no_auth: printk("RPC: Couldn't create auth handle (flavor %d)\n", flavor); rpc_free(clnt); clnt = NULL; goto out; }
#include <linux/nfs.h> #include <linux/nfs_fs.h> #include <linux/nfs_page.h> #include <linux/nfs_fs_sb.h> #include <linux/nfs_flushd.h> /* * Various constants */ #define NFSDBG_FACILITY NFSDBG_PAGECACHE /* * This is the wait queue all cluster daemons sleep on */ static struct rpc_wait_queue flushd_queue = RPC_INIT_WAITQ("nfs_flushd"); /* * Local function declarations. */ static void nfs_flushd(struct rpc_task *); static void nfs_flushd_exit(struct rpc_task *); int nfs_reqlist_init(struct nfs_server *server) { struct nfs_reqlist *cache; struct rpc_task *task; int status; dprintk("NFS: writecache_init\n");
#endif /* * We give RPC the same get_free_pages priority as NFS */ #define GFP_RPC GFP_NFS static void __rpc_default_timer(struct rpc_task *task); static void rpciod_killall(void); /* * When an asynchronous RPC task is activated within a bottom half * handler, or while executing another RPC task, it is put on * schedq, and rpciod is woken up. */ static struct rpc_wait_queue schedq = RPC_INIT_WAITQ("schedq"); /* * RPC tasks that create another task (e.g. for contacting the portmapper) * will wait on this queue for their child's completion */ static struct rpc_wait_queue childq = RPC_INIT_WAITQ("childq"); /* * RPC tasks sit here while waiting for conditions to improve. */ static struct rpc_wait_queue delay_queue = RPC_INIT_WAITQ("delayq"); /* * All RPC tasks are linked into this list */