[PATCH] knfsd: Create cache_lookup function instead of using a macro to declare one

The C++-like 'template' approach proves to be too ugly and hard to work with.

The old 'template' won't go away until all users are updated.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
NeilBrown
2006-03-27 01:15:02 -08:00
committed by Linus Torvalds
parent 7d317f2c9f
commit 15a5f6bd23
2 changed files with 110 additions and 0 deletions

View File

@ -81,6 +81,11 @@ struct cache_detail {
struct cache_detail *cd,
struct cache_head *h);
struct cache_head * (*alloc)(void);
int (*match)(struct cache_head *orig, struct cache_head *new);
void (*init)(struct cache_head *orig, struct cache_head *new);
void (*update)(struct cache_head *orig, struct cache_head *new);
/* fields below this comment are for internal use
* and should not be touched by cache owners
*/
@ -237,6 +242,13 @@ RTN *FNAME ARGS \
& FUNC##_cache, FUNC##_hash(item), FUNC##_match(item, tmp), \
STRUCT##_init(new, item), STRUCT##_update(tmp, item))
extern struct cache_head *
sunrpc_cache_lookup(struct cache_detail *detail,
struct cache_head *key, int hash);
extern struct cache_head *
sunrpc_cache_update(struct cache_detail *detail,
struct cache_head *new, struct cache_head *old, int hash);
#define cache_for_each(pos, detail, index, member) \
for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \