SUNRPC: Introduce transport switch callout for pluggable rpcbind
[powerpc.git] / net / sunrpc / clnt.c
index 3e19d32..d003c2f 100644 (file)
@@ -147,16 +147,12 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
        clnt->cl_procinfo = version->procs;
        clnt->cl_maxproc  = version->nrprocs;
        clnt->cl_protname = program->name;
-       clnt->cl_pmap     = &clnt->cl_pmap_default;
-       clnt->cl_port     = xprt->addr.sin_port;
        clnt->cl_prog     = program->number;
        clnt->cl_vers     = version->number;
-       clnt->cl_prot     = xprt->prot;
        clnt->cl_stats    = program->stats;
        clnt->cl_metrics  = rpc_alloc_iostats(clnt);
-       rpc_init_wait_queue(&clnt->cl_pmap_default.pm_bindwait, "bindwait");
 
-       if (!clnt->cl_port)
+       if (!xprt_bound(clnt->cl_xprt))
                clnt->cl_autobind = 1;
 
        clnt->cl_rtt = &clnt->cl_rtt_default;
@@ -244,8 +240,6 @@ rpc_clone_client(struct rpc_clnt *clnt)
        atomic_set(&new->cl_users, 0);
        new->cl_parent = clnt;
        atomic_inc(&clnt->cl_count);
-       /* Duplicate portmapper */
-       rpc_init_wait_queue(&new->cl_pmap_default.pm_bindwait, "bindwait");
        /* Turn off autobind on clones */
        new->cl_autobind = 0;
        new->cl_oneshot = 0;
@@ -255,8 +249,7 @@ rpc_clone_client(struct rpc_clnt *clnt)
        rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
        if (new->cl_auth)
                atomic_inc(&new->cl_auth->au_count);
-       new->cl_pmap            = &new->cl_pmap_default;
-       new->cl_metrics         = rpc_alloc_iostats(clnt);
+       new->cl_metrics = rpc_alloc_iostats(clnt);
        return new;
 out_no_clnt:
        printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__);
@@ -570,7 +563,7 @@ EXPORT_SYMBOL(rpc_max_payload);
 void rpc_force_rebind(struct rpc_clnt *clnt)
 {
        if (clnt->cl_autobind)
-               clnt->cl_port = 0;
+               xprt_clear_bound(clnt->cl_xprt);
 }
 EXPORT_SYMBOL(rpc_force_rebind);
 
@@ -781,16 +774,16 @@ call_encode(struct rpc_task *task)
 static void
 call_bind(struct rpc_task *task)
 {
-       struct rpc_clnt *clnt = task->tk_client;
+       struct rpc_xprt *xprt = task->tk_xprt;
 
        dprintk("RPC: %4d call_bind (status %d)\n",
                                task->tk_pid, task->tk_status);
 
        task->tk_action = call_connect;
-       if (!clnt->cl_port) {
+       if (!xprt_bound(xprt)) {
                task->tk_action = call_bind_status;
-               task->tk_timeout = task->tk_xprt->bind_timeout;
-               rpc_getport(task, clnt);
+               task->tk_timeout = xprt->bind_timeout;
+               xprt->ops->rpcbind(task);
        }
 }