aboutsummaryrefslogtreecommitdiff
path: root/include/linux/lockd/lockd.h
diff options
context:
space:
mode:
authorOlaf Kirch2006-10-04 02:15:59 -0700
committerLinus Torvalds2006-10-04 07:55:17 -0700
commitf2af793db02d2c2f677bdb5bf8e0efdcbf9c0256 (patch)
tree2daa40a1a128905ff514df995903d8ef8d692b04 /include/linux/lockd/lockd.h
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/lockd.h')
-rw-r--r--include/linux/lockd/lockd.h15
1 files changed, 7 insertions, 8 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 {
};
/*
- * Valid actions for nlmsvc_traverse_files
- */
-#define NLM_ACT_CHECK 0 /* check for locks */
-#define NLM_ACT_MARK 1 /* mark & sweep */
-#define NLM_ACT_UNLOCK 2 /* release all locks */
-
-/*
* Global variables
*/
extern struct rpc_program nlm_program;
@@ -183,6 +176,12 @@ void nsm_release(struct nsm_handle *);
/*
+ * This is used in garbage collection and resource reclaim
+ * A return value != 0 means destroy the lock/block/share
+ */
+typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref);
+
+/*
* Server-side lock handling
*/
u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
@@ -193,7 +192,7 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
unsigned long nlmsvc_retry_blocked(void);
void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
- int action);
+ nlm_host_match_fn_t match);
void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
/*