Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Hash table functions implementing astobj2 containers. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "astobj2_private.h"
#include "astobj2_container_private.h"
#include "asterisk/dlinkedlists.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
struct | ao2_container_hash |
struct | hash_bucket |
struct | hash_bucket_node |
struct | hash_traversal_state |
struct | hash_traversal_state_check |
Functions | |
struct ao2_container * | __ao2_container_alloc_hash (unsigned int ao2_options, unsigned int container_options, unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn, const char *tag, const char *file, int line, const char *func) |
struct ao2_container * | __ao2_container_alloc_list (unsigned int ao2_options, unsigned int container_options, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn, const char *tag, const char *file, int line, const char *func) |
static struct ao2_container * | hash_ao2_alloc_empty_clone (struct ao2_container_hash *self, const char *tag, const char *file, int line, const char *func) |
static struct ao2_container * | hash_ao2_container_init (struct ao2_container_hash *self, unsigned int options, unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn) |
Initialize a hash container with the desired number of buckets. More... | |
static void | hash_ao2_destroy (struct ao2_container_hash *self) |
static struct hash_bucket_node * | hash_ao2_find_first (struct ao2_container_hash *self, enum search_flags flags, void *arg, struct hash_traversal_state *state) |
static struct hash_bucket_node * | hash_ao2_find_next (struct ao2_container_hash *self, struct hash_traversal_state *state, struct hash_bucket_node *prev) |
static enum ao2_container_insert | hash_ao2_insert_node (struct ao2_container_hash *self, struct hash_bucket_node *node) |
static struct hash_bucket_node * | hash_ao2_iterator_next (struct ao2_container_hash *self, struct hash_bucket_node *node, enum ao2_iterator_flags flags) |
static struct hash_bucket_node * | hash_ao2_new_node (struct ao2_container_hash *self, void *obj_new, const char *tag, const char *file, int line, const char *func) |
static void | hash_ao2_node_destructor (void *v_doomed) |
static int | hash_zero (const void *user_obj, const int flags) |
always zero hash function More... | |
Variables | |
static const struct ao2_container_methods | v_table_hash |
Hash table functions implementing astobj2 containers.
Definition in file astobj2_hash.c.
struct ao2_container * __ao2_container_alloc_hash | ( | unsigned int | ao2_options, |
unsigned int | container_options, | ||
unsigned int | n_buckets, | ||
ao2_hash_fn * | hash_fn, | ||
ao2_sort_fn * | sort_fn, | ||
ao2_callback_fn * | cmp_fn, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 1067 of file astobj2_hash.c.
References __ao2_alloc(), container_destruct(), make_ari_stubs::file, hash_ao2_container_init(), ao2_container_hash::hash_fn, and ao2_container_hash::n_buckets.
Referenced by __ao2_container_alloc_list(), and hash_ao2_alloc_empty_clone().
struct ao2_container * __ao2_container_alloc_list | ( | unsigned int | ao2_options, |
unsigned int | container_options, | ||
ao2_sort_fn * | sort_fn, | ||
ao2_callback_fn * | cmp_fn, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 1085 of file astobj2_hash.c.
References __ao2_container_alloc_hash(), ao2_container::cmp_fn, make_ari_stubs::file, NULL, and ao2_container::sort_fn.
|
static |
Definition at line 116 of file astobj2_hash.c.
References __ao2_container_alloc_hash(), __is_ao2_object, ao2_options_get(), ao2_container::cmp_fn, ao2_container_hash::common, make_ari_stubs::file, ao2_container_hash::hash_fn, ao2_container_hash::n_buckets, NULL, ao2_container::options, and ao2_container::sort_fn.
|
static |
Initialize a hash container with the desired number of buckets.
self | Container to initialize. |
options | Container behaviour options (See enum ao2_container_opts) |
n_buckets | Number of buckets for hash |
hash_fn | Pointer to a function computing a hash value. |
sort_fn | Pointer to a sort function. |
cmp_fn | Pointer to a compare function used by ao2_find. |
Definition at line 1045 of file astobj2_hash.c.
References ast_atomic_fetchadd_int(), ao2_container::cmp_fn, ao2_container_hash::common, ao2_container_hash::hash_fn, hash_zero(), ao2_container_hash::n_buckets, NULL, ao2_container::options, options, ao2_container::sort_fn, ao2_container::v_table, and v_table_hash.
Referenced by __ao2_container_alloc_hash().
|
static |
Definition at line 731 of file astobj2_hash.c.
References ast_assert, AST_DLLIST_EMPTY, ast_log, ao2_container_hash::buckets, hash_bucket::list, LOG_ERROR, and ao2_container_hash::n_buckets.
|
static |
Definition at line 333 of file astobj2_hash.c.
References abs, ao2_ref, AST_DLLIST_FIRST, AST_DLLIST_LAST, AST_DLLIST_NEXT, AST_DLLIST_PREV, ao2_container_hash::buckets, ao2_container_hash::common, ao2_container_hash::hash_fn, hash_bucket_node::links, hash_bucket::list, ao2_container_hash::n_buckets, NULL, OBJ_ORDER_ASCENDING, OBJ_ORDER_DESCENDING, OBJ_ORDER_MASK, OBJ_ORDER_POST, OBJ_ORDER_PRE, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and ao2_container::sort_fn.
|
static |
Definition at line 481 of file astobj2_hash.c.
References ao2_ref, AST_DLLIST_FIRST, AST_DLLIST_LAST, AST_DLLIST_NEXT, AST_DLLIST_PREV, ao2_container_hash::buckets, hash_bucket_node::links, hash_bucket::list, hash_bucket_node::my_bucket, NULL, and OBJ_SEARCH_MASK.
|
static |
Definition at line 237 of file astobj2_hash.c.
References AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW, AO2_CONTAINER_ALLOC_OPT_DUPS_MASK, AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN, AO2_CONTAINER_INSERT_NODE_INSERTED, AO2_CONTAINER_INSERT_NODE_OBJ_REPLACED, AO2_CONTAINER_INSERT_NODE_REJECTED, ao2_ref, AST_DLLIST_INSERT_AFTER_CURRENT, AST_DLLIST_INSERT_BEFORE_CURRENT, AST_DLLIST_INSERT_HEAD, AST_DLLIST_INSERT_TAIL, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END, AST_DLLIST_TRAVERSE_SAFE_BEGIN, AST_DLLIST_TRAVERSE_SAFE_END, ao2_container_hash::buckets, hash_bucket_node::common, ao2_container_hash::common, hash_bucket_node::links, hash_bucket::list, ao2_container_node::obj, OBJ_SEARCH_OBJECT, ao2_container::options, options, ao2_container::sort_fn, and SWAP.
|
static |
Definition at line 611 of file astobj2_hash.c.
References AO2_ITERATOR_DESCENDING, AST_DLLIST_FIRST, AST_DLLIST_LAST, AST_DLLIST_NEXT, AST_DLLIST_PREV, ao2_container_hash::buckets, hash_bucket_node::links, hash_bucket::list, ao2_container_hash::n_buckets, and NULL.
|
static |
Definition at line 206 of file astobj2_hash.c.
References __ao2_ref(), abs, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_NO_REF_DEBUG, ao2_alloc_options, make_ari_stubs::file, hash_ao2_node_destructor(), ao2_container_hash::hash_fn, ao2_container_hash::n_buckets, NULL, and OBJ_SEARCH_OBJECT.
|
static |
Definition at line 143 of file astobj2_hash.c.
References __adjust_lock(), __container_unlink_node, ao2_container_check(), AO2_DEVMODE_STAT, AO2_LOCK_REQ_WRLOCK, AO2_UNLINK_NODE_UNLINK_OBJECT, AST_DLLIST_REMOVE, ast_log, ao2_container_hash::buckets, hash_bucket_node::common, ao2_container_hash::common, ao2_container::destroying, is_ao2_object, ao2_container_node::is_linked, hash_bucket::list, LOG_ERROR, hash_bucket_node::my_bucket, ao2_container_node::my_container, ao2_container_node::obj, and OBJ_NOLOCK.
Referenced by hash_ao2_new_node().
|
static |
always zero hash function
it is convenient to have a hash function that always returns 0. This is basically used when we want to have a container that is a simple linked list.
0 |
Definition at line 1028 of file astobj2_hash.c.
Referenced by hash_ao2_container_init().
|
static |
Hash container virtual method table.
Definition at line 1002 of file astobj2_hash.c.
Referenced by hash_ao2_container_init().