12 #define DEFINE_HASHTABLE(name, bits) \ 13 struct hlist_head name[1 << (bits)] = \ 14 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } 16 #define DECLARE_HASHTABLE(name, bits) \ 17 struct hlist_head name[1 << (bits)] 19 #define HASH_SIZE(name) (ARRAY_SIZE(name)) 20 #define HASH_BITS(name) ilog2(HASH_SIZE(name)) 23 #define hash_min(val, bits) \ 24 (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits)) 30 for (i = 0; i < sz; i++)
44 #define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable)) 52 #define hash_add(hashtable, node, key) \ 53 hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) 68 for (i = 0; i < sz; i++)
82 #define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable)) 100 #define hash_for_each(name, bkt, obj, member) \ 101 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ 103 hlist_for_each_entry(obj, &name[bkt], member) 114 #define hash_for_each_safe(name, bkt, tmp, obj, member) \ 115 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ 117 hlist_for_each_entry_safe(obj, tmp, &name[bkt], member) 127 #define hash_for_each_possible(name, obj, member, key) \ 128 hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member) 139 #define hash_for_each_possible_safe(name, obj, tmp, member, key) \ 140 hlist_for_each_entry_safe(obj, tmp,\ 141 &name[hash_min(key, HASH_BITS(name))], member) Double linked lists with a single pointer list head.
Definition: linuxlist.h:405
static void hlist_del_init(struct hlist_node *n)
Delete the specified hlist_node from its list and initialize.
Definition: linuxlist.h:488
#define INIT_HLIST_HEAD(ptr)
Definition: linuxlist.h:415
Simple doubly linked list implementation.
static void __hash_init(struct hlist_head *ht, unsigned int sz)
Definition: hashtable.h:26
static void hash_del(struct hlist_node *node)
hash_del - remove an object from a hashtable : &struct hlist_node of the object to remove ...
Definition: hashtable.h:88
static int hlist_empty(const struct hlist_head *h)
Is the specified hlist_head structure an empty hlist?.
Definition: linuxlist.h:455
static int hlist_unhashed(const struct hlist_node *h)
Has node been removed from list and reinitialized?.
Definition: linuxlist.h:433
static bool hash_hashed(struct hlist_node *node)
hash_hashed - check whether an object is in any hashtable : the &struct hlist_node of the object to b...
Definition: hashtable.h:59
Definition: linuxlist.h:409
static bool __hash_empty(struct hlist_head *ht, unsigned int sz)
Definition: hashtable.h:64