diff options
author | Olaf Kirch <okir@suse.de> | 2006-10-04 13:15:59 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 18:55:17 +0400 |
commit | f2af793db02d2c2f677bdb5bf8e0efdcbf9c0256 (patch) | |
tree | 2daa40a1a128905ff514df995903d8ef8d692b04 /fs/lockd/svcshare.c | |
parent | 07ba80635117c136714084e019375aa508365375 (diff) | |
download | linux-f2af793db02d2c2f677bdb5bf8e0efdcbf9c0256.tar.xz |
[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 'fs/lockd/svcshare.c')
-rw-r--r-- | fs/lockd/svcshare.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c index 27288c83da96..b9926ce8782e 100644 --- a/fs/lockd/svcshare.c +++ b/fs/lockd/svcshare.c @@ -85,24 +85,20 @@ nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file, } /* - * Traverse all shares for a given file (and host). - * NLM_ACT_CHECK is handled by nlmsvc_inspect_file. + * Traverse all shares for a given file, and delete + * those owned by the given (type of) host */ -void -nlmsvc_traverse_shares(struct nlm_host *host, struct nlm_file *file, int action) +void nlmsvc_traverse_shares(struct nlm_host *host, struct nlm_file *file, + nlm_host_match_fn_t match) { struct nlm_share *share, **shpp; shpp = &file->f_shares; while ((share = *shpp) != NULL) { - if (action == NLM_ACT_MARK) - share->s_host->h_inuse = 1; - else if (action == NLM_ACT_UNLOCK) { - if (host == NULL || host == share->s_host) { - *shpp = share->s_next; - kfree(share); - continue; - } + if (match(share->s_host, host)) { + *shpp = share->s_next; + kfree(share); + continue; } shpp = &share->s_next; } |