diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-12 09:52:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-13 22:01:00 +0300 |
commit | 7a868d1e9ab3c534c5ad44e3e5dc46753a1e5636 (patch) | |
tree | 9b490c8b37180ba0ce56ffd9ff521b43218fd8c5 /include/linux | |
parent | d2c60b1350c9a3eb7ed407c18f50306762365646 (diff) | |
download | linux-7a868d1e9ab3c534c5ad44e3e5dc46753a1e5636.tar.xz |
rhashtable: involve rhashtable_lookup_compare_insert routine
Introduce a new function called rhashtable_lookup_compare_insert()
which is very similar to rhashtable_lookup_insert(). But the former
makes use of users' given compare function to look for an object,
and then inserts it into hash table if found. As the entire process
of search and insertion is under protection of per bucket lock, this
can help users to avoid the involvement of extra lock.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/rhashtable.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 326acd8c2e9f..7b9bd77ed684 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h @@ -168,7 +168,12 @@ int rhashtable_shrink(struct rhashtable *ht); void *rhashtable_lookup(struct rhashtable *ht, const void *key); void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key, bool (*compare)(void *, void *), void *arg); + bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj); +bool rhashtable_lookup_compare_insert(struct rhashtable *ht, + struct rhash_head *obj, + bool (*compare)(void *, void *), + void *arg); void rhashtable_destroy(struct rhashtable *ht); |