From aefea3b7b1a1e7255becc0de1b0eac73d6798bed Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 16 Oct 2012 15:06:12 -0400 Subject: [PATCH] Support the add operation of urcu hash table This add operation supports redundant keys in the table. Signed-off-by: David Goulet --- src/common/hashtable/hashtable.c | 13 +++++++++++++ src/common/hashtable/hashtable.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/common/hashtable/hashtable.c b/src/common/hashtable/hashtable.c index ac39004e6..46717c9ba 100644 --- a/src/common/hashtable/hashtable.c +++ b/src/common/hashtable/hashtable.c @@ -183,6 +183,19 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht, assert(node_ptr == &node->node); } +/* + * Add unsigned long node to hashtable. + */ +void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node) +{ + assert(ht); + assert(ht->ht); + assert(node); + + cds_lfht_add(ht->ht, ht->hash_fct((void *) node->key, HASH_SEED), + &node->node); +} + /* * Add unique unsigned long node to hashtable. */ diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index f242e75e8..90b441275 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -74,6 +74,8 @@ extern void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); extern struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong( struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +extern void lttng_ht_add_ulong(struct lttng_ht *ht, + struct lttng_ht_node_ulong *node); extern int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter); -- 2.34.1