aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2014-03-23 23:58:59 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-03-30 10:47:36 -0400
commit83ddfebdd21da669918d7f9854fd592858625f4b (patch)
tree12af99c421f207cfa20f443ade38c1fd1a62f7b5 /net/sunrpc
parent47f72efa8f32e8182cd4a70d5a9a6d07651093fc (diff)
SUNRPC: New helper for creating client with rpc_xprt
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0edada973434..3c9a0f02374d 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -438,6 +438,38 @@ out_no_rpciod:
438 return ERR_PTR(err); 438 return ERR_PTR(err);
439} 439}
440 440
441struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
442 struct rpc_xprt *xprt)
443{
444 struct rpc_clnt *clnt = NULL;
445
446 clnt = rpc_new_client(args, xprt, NULL);
447 if (IS_ERR(clnt))
448 return clnt;
449
450 if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
451 int err = rpc_ping(clnt);
452 if (err != 0) {
453 rpc_shutdown_client(clnt);
454 return ERR_PTR(err);
455 }
456 }
457
458 clnt->cl_softrtry = 1;
459 if (args->flags & RPC_CLNT_CREATE_HARDRTRY)
460 clnt->cl_softrtry = 0;
461
462 if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
463 clnt->cl_autobind = 1;
464 if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
465 clnt->cl_discrtry = 1;
466 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
467 clnt->cl_chatty = 1;
468
469 return clnt;
470}
471EXPORT_SYMBOL_GPL(rpc_create_xprt);
472
441/** 473/**
442 * rpc_create - create an RPC client and transport with one call 474 * rpc_create - create an RPC client and transport with one call
443 * @args: rpc_clnt create argument structure 475 * @args: rpc_clnt create argument structure
@@ -451,7 +483,6 @@ out_no_rpciod:
451struct rpc_clnt *rpc_create(struct rpc_create_args *args) 483struct rpc_clnt *rpc_create(struct rpc_create_args *args)
452{ 484{
453 struct rpc_xprt *xprt; 485 struct rpc_xprt *xprt;
454 struct rpc_clnt *clnt;
455 struct xprt_create xprtargs = { 486 struct xprt_create xprtargs = {
456 .net = args->net, 487 .net = args->net,
457 .ident = args->protocol, 488 .ident = args->protocol,
@@ -515,30 +546,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
515 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT) 546 if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT)
516 xprt->resvport = 0; 547 xprt->resvport = 0;
517 548
518 clnt = rpc_new_client(args, xprt, NULL); 549 return rpc_create_xprt(args, xprt);
519 if (IS_ERR(clnt))
520 return clnt;
521
522 if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
523 int err = rpc_ping(clnt);
524 if (err != 0) {
525 rpc_shutdown_client(clnt);
526 return ERR_PTR(err);
527 }
528 }
529
530 clnt->cl_softrtry = 1;
531 if (args->flags & RPC_CLNT_CREATE_HARDRTRY)
532 clnt->cl_softrtry = 0;
533
534 if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
535 clnt->cl_autobind = 1;
536 if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
537 clnt->cl_discrtry = 1;
538 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
539 clnt->cl_chatty = 1;
540
541 return clnt;
542} 550}
543EXPORT_SYMBOL_GPL(rpc_create); 551EXPORT_SYMBOL_GPL(rpc_create);
544 552