aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockd
diff options
context:
space:
mode:
authorOlaf Kirch <okir@suse.de>2006-10-04 05:15:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:17 -0400
commitf2af793db02d2c2f677bdb5bf8e0efdcbf9c0256 (patch)
tree2daa40a1a128905ff514df995903d8ef8d692b04 /include/linux/lockd
parent07ba80635117c136714084e019375aa508365375 (diff)
[PATCH] knfsd: lockd: make nlm_traverse_* more flexible
This patch makes nlm_traverse{locks,blocks,shares} and friends use a function pointer rather than a "action" enum. This function pointer is given two nlm_hosts (one given by the caller, the other taken from the lock/block/share currently visited), and is free to do with them as it wants. If it returns a non-zero value, the lockd/block/share is released. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/lockd')
-rw-r--r--include/linux/lockd/lockd.h15
-rw-r--r--include/linux/lockd/share.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 777a91e1ac8f..8c1145669d06 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -134,13 +134,6 @@ struct nlm_block {
134}; 134};
135 135
136/* 136/*
137 * Valid actions for nlmsvc_traverse_files
138 */
139#define NLM_ACT_CHECK 0 /* check for locks */
140#define NLM_ACT_MARK 1 /* mark & sweep */
141#define NLM_ACT_UNLOCK 2 /* release all locks */
142
143/*
144 * Global variables 137 * Global variables
145 */ 138 */
146extern struct rpc_program nlm_program; 139extern struct rpc_program nlm_program;
@@ -183,6 +176,12 @@ void nsm_release(struct nsm_handle *);
183 176
184 177
185/* 178/*
179 * This is used in garbage collection and resource reclaim
180 * A return value != 0 means destroy the lock/block/share
181 */
182typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref);
183
184/*
186 * Server-side lock handling 185 * Server-side lock handling
187 */ 186 */
188u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 187u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
@@ -193,7 +192,7 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
193u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 192u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
194unsigned long nlmsvc_retry_blocked(void); 193unsigned long nlmsvc_retry_blocked(void);
195void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
196 int action); 195 nlm_host_match_fn_t match);
197void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32); 196void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
198 197
199/* 198/*
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index c75a424ebe4c..cd7816e74c05 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -25,6 +25,7 @@ u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *,
29 nlm_host_match_fn_t);
29 30
30#endif /* LINUX_LOCKD_SHARE_H */ 31#endif /* LINUX_LOCKD_SHARE_H */