summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6f55443)
The hash table never needs to modify the key, it is only ever used for
"match", so it should always be received as a const argument.
Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
static
void _cds_lfht_add(struct cds_lfht *ht,
cds_lfht_match_fct match,
static
void _cds_lfht_add(struct cds_lfht *ht,
cds_lfht_match_fct match,
unsigned long size,
struct cds_lfht_node *node,
struct cds_lfht_iter *unique_ret,
unsigned long size,
struct cds_lfht_node *node,
struct cds_lfht_iter *unique_ret,
static
void _cds_lfht_add(struct cds_lfht *ht,
cds_lfht_match_fct match,
static
void _cds_lfht_add(struct cds_lfht *ht,
cds_lfht_match_fct match,
unsigned long size,
struct cds_lfht_node *node,
struct cds_lfht_iter *unique_ret,
unsigned long size,
struct cds_lfht_node *node,
struct cds_lfht_iter *unique_ret,
}
void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
}
void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
- cds_lfht_match_fct match, void *key,
+ cds_lfht_match_fct match, const void *key,
struct cds_lfht_iter *iter)
{
struct cds_lfht_node *node, *next, *bucket;
struct cds_lfht_iter *iter)
{
struct cds_lfht_node *node, *next, *bucket;
}
void cds_lfht_next_duplicate(struct cds_lfht *ht, cds_lfht_match_fct match,
}
void cds_lfht_next_duplicate(struct cds_lfht *ht, cds_lfht_match_fct match,
- void *key, struct cds_lfht_iter *iter)
+ const void *key, struct cds_lfht_iter *iter)
{
struct cds_lfht_node *node, *next;
unsigned long reverse_hash;
{
struct cds_lfht_node *node, *next;
unsigned long reverse_hash;
struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *node)
{
unsigned long size;
struct cds_lfht_node *node)
{
unsigned long size;
struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *node)
{
unsigned long size;
struct cds_lfht_node *node)
{
unsigned long size;
#if (CAA_BITS_PER_LONG == 32)
static
#if (CAA_BITS_PER_LONG == 32)
static
-unsigned long test_hash(void *_key, size_t length, unsigned long seed)
+unsigned long test_hash(const void *_key, size_t length, unsigned long seed)
{
unsigned int key = (unsigned int) _key;
{
unsigned int key = (unsigned int) _key;
-unsigned long test_hash(void *_key, size_t length, unsigned long seed)
+unsigned long test_hash(const void *_key, size_t length, unsigned long seed)
-unsigned long test_compare(void *key1, size_t key1_len,
- void *key2, size_t key2_len)
+unsigned long test_compare(const void *key1, size_t key1_len,
+ const void *key2, size_t key2_len)
{
if (caa_unlikely(key1_len != key2_len))
return -1;
{
if (caa_unlikely(key1_len != key2_len))
return -1;
-int test_match(struct cds_lfht_node *node, void *key)
+int test_match(struct cds_lfht_node *node, const void *key)
{
struct lfht_test_node *test_node = to_test_node(node);
{
struct lfht_test_node *test_node = to_test_node(node);
* Ensure reader and writer threads are registered as urcu readers.
*/
* Ensure reader and writer threads are registered as urcu readers.
*/
-typedef int (*cds_lfht_match_fct)(struct cds_lfht_node *node, void *key);
+typedef int (*cds_lfht_match_fct)(struct cds_lfht_node *node, const void *key);
/*
* cds_lfht_node_init - initialize a hash table node
/*
* cds_lfht_node_init - initialize a hash table node
* Threads calling this API need to be registered RCU read-side threads.
*/
void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
* Threads calling this API need to be registered RCU read-side threads.
*/
void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
- cds_lfht_match_fct match, void *key,
+ cds_lfht_match_fct match, const void *key,
struct cds_lfht_iter *iter);
/*
struct cds_lfht_iter *iter);
/*
* Threads calling this API need to be registered RCU read-side threads.
*/
void cds_lfht_next_duplicate(struct cds_lfht *ht,
* Threads calling this API need to be registered RCU read-side threads.
*/
void cds_lfht_next_duplicate(struct cds_lfht *ht,
- cds_lfht_match_fct match, void *key,
+ cds_lfht_match_fct match, const void *key,
struct cds_lfht_iter *iter);
/*
struct cds_lfht_iter *iter);
/*
struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *node);
/*
struct cds_lfht_node *node);
/*
struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht,
unsigned long hash,
cds_lfht_match_fct match,
struct cds_lfht_node *node);
/*
struct cds_lfht_node *node);
/*