- DEFINE_HASHTABLE
- 使用实例
struct hlist_head {
struct hlist_node *first;
};
struct hlist_node {
struct hlist_node *next, **pprev;
};
#define HLIST_HEAD_INIT { .first = NULL }
#define DEFINE_HASHTABLE(name, bits) 定义一个hash表,名称,以及多少个元素。
struct hlist_head name[1 << (bits)] =
{ [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } 、、、 这里三个点是什么意思?给所有的元素赋初值
使用实例
/kernel/timer/posix-timer.c
static DEFINE_HASHTABLE(posix_timers_hashtable, 9); 、、定义了posix_timers_hashtable, 2的9次方个元素。


![Linux:Hashlist/hashtable: [积木] Linux:Hashlist/hashtable: [积木]](http://www.mshxw.com/aiimages/31/694864.png)
