From: David Goulet Date: Tue, 16 Oct 2012 19:06:12 +0000 (-0400) Subject: Support the add operation of urcu hash table X-Git-Tag: v2.1.0-rc5~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aefea3b7b1a1e7255becc0de1b0eac73d6798bed;p=lttng-tools.git Support the add operation of urcu hash table This add operation supports redundant keys in the table. Signed-off-by: David Goulet --- 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);