X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.h;h=4a8a2bd5c53a184b40ebe5484213816934a80300;hp=90b4412756cb9f6f0d93e25b752e232bb69399ee;hb=efa116c6f19ecdc344a82709e7d919703ec96c45;hpb=aefea3b7b1a1e7255becc0de1b0eac73d6798bed diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index 90b441275..4a8a2bd5c 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -19,16 +19,20 @@ #define _LTT_HT_H #include +#include #include "rculfhash.h" #include "rculfhash-internal.h" +extern unsigned long lttng_ht_seed; + typedef unsigned long (*hash_fct)(void *_key, unsigned long seed); typedef cds_lfht_match_fct hash_match_fct; enum lttng_ht_type { LTTNG_HT_TYPE_STRING, LTTNG_HT_TYPE_ULONG, + LTTNG_HT_TYPE_U64, }; struct lttng_ht { @@ -53,6 +57,12 @@ struct lttng_ht_node_ulong { struct rcu_head head; }; +struct lttng_ht_node_u64 { + uint64_t key; + struct cds_lfht_node node; + struct rcu_head head; +}; + /* Hashtable new and destroy */ extern struct lttng_ht *lttng_ht_new(unsigned long size, int type); extern void lttng_ht_destroy(struct lttng_ht *ht); @@ -61,8 +71,11 @@ extern void lttng_ht_destroy(struct lttng_ht *ht); extern void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key); extern void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node, unsigned long key); +extern void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, + uint64_t key); extern void lttng_ht_node_free_str(struct lttng_ht_node_str *node); extern void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node); +extern void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node); extern void lttng_ht_lookup(struct lttng_ht *ht, void *key, struct lttng_ht_iter *iter); @@ -72,10 +85,18 @@ extern void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node); extern void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +extern void lttng_ht_add_unique_u64(struct lttng_ht *ht, + struct lttng_ht_node_u64 *node); extern struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong( struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +extern struct lttng_ht_node_u64 *lttng_ht_add_replace_u64( + struct lttng_ht *ht, struct lttng_ht_node_u64 *node); +extern void lttng_ht_add_str(struct lttng_ht *ht, + struct lttng_ht_node_str *node); extern void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +extern void lttng_ht_add_u64(struct lttng_ht *ht, + struct lttng_ht_node_u64 *node); extern int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter); @@ -89,5 +110,7 @@ extern struct lttng_ht_node_str *lttng_ht_iter_get_node_str( struct lttng_ht_iter *iter); extern struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong( struct lttng_ht_iter *iter); +extern struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64( + struct lttng_ht_iter *iter); #endif /* _LTT_HT_H */