aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
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 /include/linux/sunrpc
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 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/clnt.h3
-rw-r--r--include/linux/sunrpc/sched.h20
2 files changed, 16 insertions, 7 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab151bbb66df..b0ab959eca65 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -126,7 +126,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
127 127
128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
129 int flags, rpc_action callback, void *clntdata); 129 int flags, const struct rpc_call_ops *tk_ops,
130 void *calldata);
130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 131int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
131 int flags); 132 int flags);
132void rpc_restart_call(struct rpc_task *); 133void rpc_restart_call(struct rpc_task *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 4c4b2dc8aca5..581d8cdc3b86 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -27,6 +27,7 @@ struct rpc_message {
27 struct rpc_cred * rpc_cred; /* Credentials */ 27 struct rpc_cred * rpc_cred; /* Credentials */
28}; 28};
29 29
30struct rpc_call_ops;
30struct rpc_wait_queue; 31struct rpc_wait_queue;
31struct rpc_wait { 32struct rpc_wait {
32 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
@@ -61,13 +62,12 @@ struct rpc_task {
61 * timeout_fn to be executed by timer bottom half 62 * timeout_fn to be executed by timer bottom half
62 * callback to be executed after waking up 63 * callback to be executed after waking up
63 * action next procedure for async tasks 64 * action next procedure for async tasks
64 * exit exit async task and report to caller 65 * tk_ops caller callbacks
65 */ 66 */
66 void (*tk_timeout_fn)(struct rpc_task *); 67 void (*tk_timeout_fn)(struct rpc_task *);
67 void (*tk_callback)(struct rpc_task *); 68 void (*tk_callback)(struct rpc_task *);
68 void (*tk_action)(struct rpc_task *); 69 void (*tk_action)(struct rpc_task *);
69 void (*tk_exit)(struct rpc_task *); 70 const struct rpc_call_ops *tk_ops;
70 void (*tk_release)(struct rpc_task *);
71 void * tk_calldata; 71 void * tk_calldata;
72 72
73 /* 73 /*
@@ -111,6 +111,12 @@ struct rpc_task {
111 111
112typedef void (*rpc_action)(struct rpc_task *); 112typedef void (*rpc_action)(struct rpc_task *);
113 113
114struct rpc_call_ops {
115 void (*rpc_call_done)(struct rpc_task *, void *);
116 void (*rpc_release)(void *);
117};
118
119
114/* 120/*
115 * RPC task flags 121 * RPC task flags
116 */ 122 */
@@ -228,10 +234,12 @@ struct rpc_wait_queue {
228/* 234/*
229 * Function prototypes 235 * Function prototypes
230 */ 236 */
231struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); 237struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
238 const struct rpc_call_ops *ops, void *data);
232struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); 239struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
233void rpc_init_task(struct rpc_task *, struct rpc_clnt *, 240void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
234 rpc_action exitfunc, int flags); 241 int flags, const struct rpc_call_ops *ops,
242 void *data);
235void rpc_release_task(struct rpc_task *); 243void rpc_release_task(struct rpc_task *);
236void rpc_exit_task(struct rpc_task *); 244void rpc_exit_task(struct rpc_task *);
237void rpc_killall_tasks(struct rpc_clnt *); 245void rpc_killall_tasks(struct rpc_clnt *);