X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.h;h=2c77f0afcd8d7dc62f2f2b2b7d07f2ff27a4897e;hb=HEAD;hp=d2d6979bae1682c22515acbf8f413e939d1dca8f;hpb=d14d33bf091e72b23b1f90ea18a0a01bed098b76;p=lttng-tools.git diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h deleted file mode 100644 index d2d6979ba..000000000 --- a/src/common/hashtable/hashtable.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011 - David Goulet - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef _LTT_HT_H -#define _LTT_HT_H - -#include - -#include "rculfhash.h" -#include "rculfhash-internal.h" - -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, -}; - -struct lttng_ht { - struct cds_lfht *ht; - cds_lfht_match_fct match_fct; - hash_fct hash_fct; -}; - -struct lttng_ht_iter { - struct cds_lfht_iter iter; -}; - -struct lttng_ht_node_str { - char *key; - struct cds_lfht_node node; - struct rcu_head head; -}; - -struct lttng_ht_node_ulong { - unsigned long 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); - -/* 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, - unsigned long 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_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, - struct lttng_ht_node_str *node); -extern void lttng_ht_add_unique_ulong(struct lttng_ht *ht, - struct lttng_ht_node_ulong *node); -struct lttng_ht_node_ulong *lttng_ht_add_replace_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); - -extern 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); - -extern unsigned long lttng_ht_get_count(struct lttng_ht *ht); - -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); - -#endif /* _LTT_HT_H */