7.7 Linux内核中的通用链表(上)
双向循环链表
在进程、文件、模块、设备驱动中大量使用
定义:include/linux/list.h、 include/linux/types.h 中
通用在哪里?
定义了针对链表的一些基本操作
不同的数据类型都可以据此构建自己的链表
内核代码
__list_add(srtuct list_head *new,
srtuct list_head *prev,
srtuct list_head *next);
//内核里面使用的接口
void list_add(srtuct list_head *new,srtuct list_head head
){
__list_add(new,head,head->next);
}
//留给用户的接口,头插法