Linux内核环形双向链表本身不实现锁机制,需要驱动本身完成锁机制实现。

1.1、list_head结构体

#include <linux/list.h>

struct list_head {
struct list_head *next;
struct list_head *prev;
}; list_head结构体本身只包含next和prev两个节点,实际使用时需要自定义结构体包含list_head结构体,如: struct user_struct
{
struct list_head list;
int flags; /* user own data */
};

1.2、初始化

INIT_LIST_HEAD(struct list_head *list_head);
或者
LIST_HEAD(struct list_head list_head);

1.3、操作函数

#include <linux/list.h>

在链表头添加链表节点
list_add(struct list_head *new, struct list_head *head); 在链表尾添加链表节点
list_add_tail(struct list_head *new, struct list_head *head); 删除链表节点
list_del(struct list_head *entry);
list_del_init(struct list_head *entry); 移动链表节点
list_move(struct list_head *entry, struct list_head *head);
list_move_tail(struct list_head *entry, struct list_head *head); 检查链表是否为空,如果为空,返回非零值
list_empty(list_move(struct list_head *head); 遍历链表
list_for_each(struct list_head *cursor, struct list_head *list);

最新文章

  1. python获取绝对路径
  2. Python安装mysql-python错误提示python setup.py egg_info
  3. Windows Store App 控件动画
  4. 用于json的 .ashx 小细节
  5. 我的android学习经历29
  6. JQuery POST请求乱码...
  7. Android+struts2+JSON方式的手机开发(Login)
  8. sql加强练习
  9. ios打包应用程序,生成ipa文件
  10. 给图片使用border-radius 图片会变成圆的。
  11. 2.css字体单位
  12. 【一天一道LeetCode】#117. Populating Next Right Pointers in Each Node II
  13. 解决Android编译时出现aapt.exe finished with non-zero exit value 1(第二篇)
  14. 使用ant编译zookeeper源码
  15. Git 简单入门(一)
  16. $(&quot;&quot;).append无反应
  17. logback框架之——日志分割所带来的潜在问题
  18. vue中父子组件之间的传值、非父子组件之间的传值
  19. PTA寒假二
  20. TensorFlow中的优化算法

热门文章

  1. js apply与call的用法与区别
  2. shell编程注意点
  3. java面试题全集(中)
  4. ip - Linux IPv4 协议实现
  5. 最简单的Android项目(添加jar文件)
  6. centos7使用cron任务的相关命令(与centos6有区别)
  7. QByteArray引发的bug
  8. ubuntu 安装nginx redis dotnet
  9. Spring MVC文件上传下载(转载)
  10. CSS基础-如何用border写三角形?