aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-03 03:55:04 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:39 -0500
commit963d8fe53339128ee46a7701f2e36305f0ccff8c (patch)
tree426736c70a8e05cb1d945d5c7f44ea6475edd113 /net/sunrpc/clnt.c
parentabbcf28f23d53e8ec56a91f3528743913fa2694a (diff)
RPC: Clean up RPC task structure
Shrink the RPC task structure. Instead of storing separate pointers for task->tk_exit and task->tk_release, put them in a structure. Also pass the user data pointer as a parameter instead of passing it via task->tk_calldata. This enables us to nest callbacks. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6ab4cbd8a901..8b2f75bc006d 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -374,10 +374,14 @@ out:
374 * Default callback for async RPC calls 374 * Default callback for async RPC calls
375 */ 375 */
376static void 376static void
377rpc_default_callback(struct rpc_task *task) 377rpc_default_callback(struct rpc_task *task, void *data)
378{ 378{
379} 379}
380 380
381static const struct rpc_call_ops rpc_default_ops = {
382 .rpc_call_done = rpc_default_callback,
383};
384
381/* 385/*
382 * Export the signal mask handling for synchronous code that 386 * Export the signal mask handling for synchronous code that
383 * sleeps on RPC calls 387 * sleeps on RPC calls
@@ -432,7 +436,7 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
432 BUG_ON(flags & RPC_TASK_ASYNC); 436 BUG_ON(flags & RPC_TASK_ASYNC);
433 437
434 status = -ENOMEM; 438 status = -ENOMEM;
435 task = rpc_new_task(clnt, NULL, flags); 439 task = rpc_new_task(clnt, flags, &rpc_default_ops, NULL);
436 if (task == NULL) 440 if (task == NULL)
437 goto out; 441 goto out;
438 442
@@ -459,7 +463,7 @@ out:
459 */ 463 */
460int 464int
461rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, 465rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
462 rpc_action callback, void *data) 466 const struct rpc_call_ops *tk_ops, void *data)
463{ 467{
464 struct rpc_task *task; 468 struct rpc_task *task;
465 sigset_t oldset; 469 sigset_t oldset;
@@ -472,12 +476,9 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
472 flags |= RPC_TASK_ASYNC; 476 flags |= RPC_TASK_ASYNC;
473 477
474 /* Create/initialize a new RPC task */ 478 /* Create/initialize a new RPC task */
475 if (!callback)
476 callback = rpc_default_callback;
477 status = -ENOMEM; 479 status = -ENOMEM;
478 if (!(task = rpc_new_task(clnt, callback, flags))) 480 if (!(task = rpc_new_task(clnt, flags, tk_ops, data)))
479 goto out; 481 goto out;
480 task->tk_calldata = data;
481 482
482 /* Mask signals on GSS_AUTH upcalls */ 483 /* Mask signals on GSS_AUTH upcalls */
483 rpc_task_sigmask(task, &oldset); 484 rpc_task_sigmask(task, &oldset);