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);

Linux驱动开发10——内核环形双向链表的更多相关文章

  1. linux驱动开发---导出内核符号

    导出内核符号模板代码,验证小实例: /** *Copyright (c) 2013.TianYuan *All rights reserved. * *文件名称: Esdexp.c *文件标识: 导出 ...

  2. Linux驱动开发必看详解神秘内核(完全转载)

    Linux驱动开发必看详解神秘内核 完全转载-链接:http://blog.chinaunix.net/uid-21356596-id-1827434.html   IT168 技术文档]在开始步入L ...

  3. Linux内核(17) - 高效学习Linux驱动开发

    这本<Linux内核修炼之道>已经开卖(网上的链接为: 卓越.当当.china-pub ),虽然是严肃文学,但为了保证流畅性,大部分文字我还都是斟词灼句,反复的念几遍才写上去的,尽量考虑到 ...

  4. Linux 驱动开发

    linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...

  5. 嵌入式Linux驱动开发日记

    嵌入式Linux驱动开发日记 主机硬件环境 开发机:虚拟机Ubuntu12.04 内存: 1G 硬盘:80GB 目标板硬件环境 CPU: SP5V210 (开发板:QT210) SDRAM: 512M ...

  6. Linux驱动开发学习的一些必要步骤

      1. 学会写简单的makefile 2. 编一应用程序,可以用makefile跑起来 3. 学会写驱动的makefile 4. 写一简单char驱动,makefile编译通过,可以insmod, ...

  7. 驱动编程思想之初体验 --------------- 嵌入式linux驱动开发之点亮LED

    这节我们就开始开始进行实战啦!这里顺便说一下啊,出来做开发的基础很重要啊,基础不好,迟早是要恶补的.个人深刻觉得像这种嵌入式的开发对C语言和微机接口与原理是非常依赖的,必须要有深厚的基础才能hold的 ...

  8. 驱动开发:内核枚举DpcTimer定时器

    在笔者上一篇文章<驱动开发:内核枚举IoTimer定时器>中我们通过IoInitializeTimer这个API函数为跳板,向下扫描特征码获取到了IopTimerQueueHead也就是I ...

  9. 嵌入式linux驱动开发之点亮led(驱动编程思想之初体验)

    这节我们就开始开始进行实战啦!这里顺便说一下啊,出来做开发的基础很重要啊,基础不好,迟早是要恶补的.个人深刻觉得像这种嵌入式的开发对C语言和微机接口与原理是非常依赖的,必须要有深厚的基础才能hold的 ...

随机推荐

  1. [转载]Ubuntu环境下检查CPU 的温度

    原文地址:https://www.linuxprobe.com/ubuntu-cpu-temperature.html 我们将使用一个GUI工具Psensor,它允许你在Linux中监控硬件温度.用P ...

  2. 利用bing图片搜索接口开发图片搜索应用程序

    概述:通过bing的图片搜索引擎,开发自己的图片搜索应用程序.bing的图片搜索接口是收费的,但是初次注册使用,key可以免费试用30天 程序运行效果如下 一,代码如下 static SearchRe ...

  3. yii报错yii\web\Request::cookieValidationKey must be configured with a secret key.

    在config文件下main-local.php配置 'cookieValidationKey' => 'rabbit1234',

  4. Git命令之:git push

    保护版权:转自,http://www.yiibai.com/git/git_push.html

  5. linux格式化磁盘命令

    linux格式化磁盘命令           linux mkfs         指令:mkfs 使用权限 : 超级使用者 使用方式 : mkfs [-V] [-t fstype] [fs-opti ...

  6. (转) 修改weblogic部署的应用名称

    通过weblogic管理后台console进行发布本地项目的时候,它会默认以WEB-INF的上一级目录作为访问路径, 如,假如你的项目WEB-INF目录的上一层是WebRoot,那么发布后, 访问的路 ...

  7. css画心形、三角形的总结

    .heart { width: 10px; height: 10px; /* position: fixed; */ background: #fff; transform: rotate(45deg ...

  8. Solaris 11中配置基于link的IPMP

    http://blog.itpub.net/29960937/viewspace-1347901/ Tips: Record and feedback errors you have encounte ...

  9. NOIP2015普及组总结

    NOIP2015普及组总结 这次考试总体感觉不错,不过觉得时间有点紧,在最后30分钟才打完. 第一题(金币coin):大大的W!爆搜O(N),一分钟打完: 第二题(扫雷游戏mine):同上: 第三题( ...

  10. kong CentOS7网关安装

    1.先安装postgres数据库,yum安装.yum install postgresql96yum install postgresql96-server配置环境变量export PGDATA=/v ...