aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-12-20 16:03:53 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:58 -0500
commit698b6d088e8a5d907596c689d5ae9109611c5b59 (patch)
tree0e6465b1647fbd731fb2794d34ab5efa14e2465d /net
parent69dd716c5ffd89f5ba14ffb871d633ecea74d13a (diff)
SUNRPC: cleanup for rpc_new_client()
There is no reason why we shouldn't just pass the rpc_create_args. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 3af35ab0e99d..6a6b96e8dcb2 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -122,8 +122,9 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
122 } 122 }
123} 123}
124 124
125static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, struct rpc_program *program, u32 vers, rpc_authflavor_t flavor) 125static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt)
126{ 126{
127 struct rpc_program *program = args->program;
127 struct rpc_version *version; 128 struct rpc_version *version;
128 struct rpc_clnt *clnt = NULL; 129 struct rpc_clnt *clnt = NULL;
129 struct rpc_auth *auth; 130 struct rpc_auth *auth;
@@ -132,13 +133,13 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
132 133
133 /* sanity check the name before trying to print it */ 134 /* sanity check the name before trying to print it */
134 err = -EINVAL; 135 err = -EINVAL;
135 len = strlen(servname); 136 len = strlen(args->servername);
136 if (len > RPC_MAXNETNAMELEN) 137 if (len > RPC_MAXNETNAMELEN)
137 goto out_no_rpciod; 138 goto out_no_rpciod;
138 len++; 139 len++;
139 140
140 dprintk("RPC: creating %s client for %s (xprt %p)\n", 141 dprintk("RPC: creating %s client for %s (xprt %p)\n",
141 program->name, servname, xprt); 142 program->name, args->servername, xprt);
142 143
143 err = rpciod_up(); 144 err = rpciod_up();
144 if (err) 145 if (err)
@@ -146,7 +147,11 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
146 err = -EINVAL; 147 err = -EINVAL;
147 if (!xprt) 148 if (!xprt)
148 goto out_no_xprt; 149 goto out_no_xprt;
149 if (vers >= program->nrvers || !(version = program->version[vers])) 150
151 if (args->version >= program->nrvers)
152 goto out_err;
153 version = program->version[args->version];
154 if (version == NULL)
150 goto out_err; 155 goto out_err;
151 156
152 err = -ENOMEM; 157 err = -ENOMEM;
@@ -158,12 +163,12 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
158 clnt->cl_server = clnt->cl_inline_name; 163 clnt->cl_server = clnt->cl_inline_name;
159 if (len > sizeof(clnt->cl_inline_name)) { 164 if (len > sizeof(clnt->cl_inline_name)) {
160 char *buf = kmalloc(len, GFP_KERNEL); 165 char *buf = kmalloc(len, GFP_KERNEL);
161 if (buf != 0) 166 if (buf != NULL)
162 clnt->cl_server = buf; 167 clnt->cl_server = buf;
163 else 168 else
164 len = sizeof(clnt->cl_inline_name); 169 len = sizeof(clnt->cl_inline_name);
165 } 170 }
166 strlcpy(clnt->cl_server, servname, len); 171 strlcpy(clnt->cl_server, args->servername, len);
167 172
168 clnt->cl_xprt = xprt; 173 clnt->cl_xprt = xprt;
169 clnt->cl_procinfo = version->procs; 174 clnt->cl_procinfo = version->procs;
@@ -192,10 +197,10 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
192 if (err < 0) 197 if (err < 0)
193 goto out_no_path; 198 goto out_no_path;
194 199
195 auth = rpcauth_create(flavor, clnt); 200 auth = rpcauth_create(args->authflavor, clnt);
196 if (IS_ERR(auth)) { 201 if (IS_ERR(auth)) {
197 printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n", 202 printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n",
198 flavor); 203 args->authflavor);
199 err = PTR_ERR(auth); 204 err = PTR_ERR(auth);
200 goto out_no_auth; 205 goto out_no_auth;
201 } 206 }
@@ -297,8 +302,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
297 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT) 302 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT)
298 xprt->resvport = 0; 303 xprt->resvport = 0;
299 304
300 clnt = rpc_new_client(xprt, args->servername, args->program, 305 clnt = rpc_new_client(args, xprt);
301 args->version, args->authflavor);
302 if (IS_ERR(clnt)) 306 if (IS_ERR(clnt))
303 return clnt; 307 return clnt;
304 308