diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-14 15:39:59 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:30 -0500 |
commit | c970aa85e71bd581726c42df843f6f129db275ac (patch) | |
tree | e7fc90ee4064196d357045fd173764e0b8fc8ca8 /net | |
parent | 84115e1cd4a3614c4e566d4cce31381dce3dbef9 (diff) |
SUNRPC: Clean up rpc_run_task
Make it use the new task initialiser structure instead of acting as a
wrapper.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 36 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 8 |
2 files changed, 16 insertions, 28 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 7c80abd9263f..9aad45946d32 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -523,8 +523,11 @@ void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset) | |||
523 | } | 523 | } |
524 | EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask); | 524 | EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask); |
525 | 525 | ||
526 | static | 526 | /** |
527 | struct rpc_task *rpc_do_run_task(const struct rpc_task_setup *task_setup_data) | 527 | * rpc_run_task - Allocate a new RPC task, then run rpc_execute against it |
528 | * @task_setup_data: pointer to task initialisation data | ||
529 | */ | ||
530 | struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) | ||
528 | { | 531 | { |
529 | struct rpc_task *task, *ret; | 532 | struct rpc_task *task, *ret; |
530 | sigset_t oldset; | 533 | sigset_t oldset; |
@@ -553,6 +556,7 @@ out: | |||
553 | rpc_restore_sigmask(&oldset); | 556 | rpc_restore_sigmask(&oldset); |
554 | return ret; | 557 | return ret; |
555 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(rpc_run_task); | ||
556 | 560 | ||
557 | /** | 561 | /** |
558 | * rpc_call_sync - Perform a synchronous RPC call | 562 | * rpc_call_sync - Perform a synchronous RPC call |
@@ -573,7 +577,7 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) | |||
573 | 577 | ||
574 | BUG_ON(flags & RPC_TASK_ASYNC); | 578 | BUG_ON(flags & RPC_TASK_ASYNC); |
575 | 579 | ||
576 | task = rpc_do_run_task(&task_setup_data); | 580 | task = rpc_run_task(&task_setup_data); |
577 | if (IS_ERR(task)) | 581 | if (IS_ERR(task)) |
578 | return PTR_ERR(task); | 582 | return PTR_ERR(task); |
579 | status = task->tk_status; | 583 | status = task->tk_status; |
@@ -603,7 +607,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
603 | .flags = flags|RPC_TASK_ASYNC, | 607 | .flags = flags|RPC_TASK_ASYNC, |
604 | }; | 608 | }; |
605 | 609 | ||
606 | task = rpc_do_run_task(&task_setup_data); | 610 | task = rpc_run_task(&task_setup_data); |
607 | if (IS_ERR(task)) | 611 | if (IS_ERR(task)) |
608 | return PTR_ERR(task); | 612 | return PTR_ERR(task); |
609 | rpc_put_task(task); | 613 | rpc_put_task(task); |
@@ -611,28 +615,6 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
611 | } | 615 | } |
612 | EXPORT_SYMBOL_GPL(rpc_call_async); | 616 | EXPORT_SYMBOL_GPL(rpc_call_async); |
613 | 617 | ||
614 | /** | ||
615 | * rpc_run_task - Allocate a new RPC task, then run rpc_execute against it | ||
616 | * @clnt: pointer to RPC client | ||
617 | * @flags: RPC flags | ||
618 | * @ops: RPC call ops | ||
619 | * @data: user call data | ||
620 | */ | ||
621 | struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, | ||
622 | const struct rpc_call_ops *tk_ops, | ||
623 | void *data) | ||
624 | { | ||
625 | struct rpc_task_setup task_setup_data = { | ||
626 | .rpc_client = clnt, | ||
627 | .callback_ops = tk_ops, | ||
628 | .callback_data = data, | ||
629 | .flags = flags, | ||
630 | }; | ||
631 | |||
632 | return rpc_do_run_task(&task_setup_data); | ||
633 | } | ||
634 | EXPORT_SYMBOL_GPL(rpc_run_task); | ||
635 | |||
636 | void | 618 | void |
637 | rpc_call_setup(struct rpc_task *task, const struct rpc_message *msg, int flags) | 619 | rpc_call_setup(struct rpc_task *task, const struct rpc_message *msg, int flags) |
638 | { | 620 | { |
@@ -1550,7 +1532,7 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int | |||
1550 | .callback_ops = &rpc_default_ops, | 1532 | .callback_ops = &rpc_default_ops, |
1551 | .flags = flags, | 1533 | .flags = flags, |
1552 | }; | 1534 | }; |
1553 | return rpc_do_run_task(&task_setup_data); | 1535 | return rpc_run_task(&task_setup_data); |
1554 | } | 1536 | } |
1555 | EXPORT_SYMBOL_GPL(rpc_call_null); | 1537 | EXPORT_SYMBOL_GPL(rpc_call_null); |
1556 | 1538 | ||
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index a05493aedb68..7c362e5f6e1b 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -310,6 +310,10 @@ void rpcb_getport_async(struct rpc_task *task) | |||
310 | struct rpc_clnt *rpcb_clnt; | 310 | struct rpc_clnt *rpcb_clnt; |
311 | static struct rpcbind_args *map; | 311 | static struct rpcbind_args *map; |
312 | struct rpc_task *child; | 312 | struct rpc_task *child; |
313 | struct rpc_task_setup task_setup_data = { | ||
314 | .callback_ops = &rpcb_getport_ops, | ||
315 | .flags = RPC_TASK_ASYNC, | ||
316 | }; | ||
313 | struct sockaddr addr; | 317 | struct sockaddr addr; |
314 | int status; | 318 | int status; |
315 | struct rpcb_info *info; | 319 | struct rpcb_info *info; |
@@ -395,7 +399,9 @@ void rpcb_getport_async(struct rpc_task *task) | |||
395 | sizeof(map->r_addr)); | 399 | sizeof(map->r_addr)); |
396 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ | 400 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ |
397 | 401 | ||
398 | child = rpc_run_task(rpcb_clnt, RPC_TASK_ASYNC, &rpcb_getport_ops, map); | 402 | task_setup_data.rpc_client = rpcb_clnt; |
403 | task_setup_data.callback_data = map; | ||
404 | child = rpc_run_task(&task_setup_data); | ||
399 | rpc_release_client(rpcb_clnt); | 405 | rpc_release_client(rpcb_clnt); |
400 | if (IS_ERR(child)) { | 406 | if (IS_ERR(child)) { |
401 | status = -EIO; | 407 | status = -EIO; |