X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.h;h=a3d41d94d29a4f1b04f716980b8497156f5e3f1f;hp=846c5ec47277596fdb231e766feb6f177c9e2f62;hb=8684af09caa3ca7014048753361c23d00f8e3be6;hpb=7972aab22f74b18faa168c0482216a3dd711a075 diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index 846c5ec47..a3d41d94d 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -21,8 +21,8 @@ #include #include -#include "rculfhash.h" -#include "rculfhash-internal.h" +#include +#include extern unsigned long lttng_ht_seed; @@ -33,6 +33,7 @@ enum lttng_ht_type { LTTNG_HT_TYPE_STRING, LTTNG_HT_TYPE_ULONG, LTTNG_HT_TYPE_U64, + LTTNG_HT_TYPE_TWO_U64, }; struct lttng_ht { @@ -63,52 +64,100 @@ struct lttng_ht_node_u64 { struct rcu_head head; }; +struct lttng_ht_two_u64 { + uint64_t key1; + uint64_t key2; +}; + +struct lttng_ht_node_two_u64 { + struct lttng_ht_two_u64 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); +LTTNG_HIDDEN +struct lttng_ht *lttng_ht_new(unsigned long size, int type); +LTTNG_HIDDEN +void lttng_ht_destroy(struct lttng_ht *ht); /* Specialized node init and free functions */ -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, +LTTNG_HIDDEN +void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key); +LTTNG_HIDDEN +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, +LTTNG_HIDDEN +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, +LTTNG_HIDDEN +void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node, + uint64_t key1, uint64_t key2); +LTTNG_HIDDEN +void lttng_ht_node_free_str(struct lttng_ht_node_str *node); +LTTNG_HIDDEN +void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node); +LTTNG_HIDDEN +void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node); +LTTNG_HIDDEN +void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node); + +LTTNG_HIDDEN +void lttng_ht_lookup(struct lttng_ht *ht, void *key, struct lttng_ht_iter *iter); /* Specialized add unique functions */ -extern void lttng_ht_add_unique_str(struct lttng_ht *ht, +LTTNG_HIDDEN +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, +LTTNG_HIDDEN +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, +LTTNG_HIDDEN +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( +LTTNG_HIDDEN +void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, + struct lttng_ht_node_two_u64 *node); +LTTNG_HIDDEN +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( +LTTNG_HIDDEN +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_ulong(struct lttng_ht *ht, +LTTNG_HIDDEN +void lttng_ht_add_str(struct lttng_ht *ht, + struct lttng_ht_node_str *node); +LTTNG_HIDDEN +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, +LTTNG_HIDDEN +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); +LTTNG_HIDDEN +int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter); -extern void lttng_ht_get_first(struct lttng_ht *ht, +LTTNG_HIDDEN +void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_ht_iter *iter); -extern void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter); +LTTNG_HIDDEN +void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter); -extern unsigned long lttng_ht_get_count(struct lttng_ht *ht); +LTTNG_HIDDEN +unsigned long lttng_ht_get_count(struct lttng_ht *ht); -extern struct lttng_ht_node_str *lttng_ht_iter_get_node_str( +LTTNG_HIDDEN +struct lttng_ht_node_str *lttng_ht_iter_get_node_str( + struct lttng_ht_iter *iter); +LTTNG_HIDDEN +struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong( struct lttng_ht_iter *iter); -extern struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong( +LTTNG_HIDDEN +struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64( struct lttng_ht_iter *iter); -extern struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64( +LTTNG_HIDDEN +struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64( struct lttng_ht_iter *iter); #endif /* _LTT_HT_H */