1.哈希链表的移动
1>function:将以个哈希聊表的头结点用new结点代替,将以前的头结点删除。
2>接口:
static inline void hlist_move_list(struct hlist_head *old, struct hlist_head *new)
struct hlist_head *old:原先哈希链表的头结点
struct hlist_head *new:新替换的哈希链表的头结点
3>实现:
static inline void hlist_move_list(struct hlist_head *old, struct hlist_head *new)
{
new->first = old->first;
if (new->first)
new->fist->pprev = &new->first;
old->first = NULL;
}
Step1: 将new结点的first指向old的第一个结点
Step2: 判断链表头结点后是否有哈希结点。如果为空,则不操作。否则,将表头后的第一个结点的pprev指向新表头结点的first.
Step3:将原先哈希链表头结点的first指向空。
