文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > linux内核部件分析-连通世界的list head
侵权投诉

linux内核部件分析-连通世界的list head

在linux内核中,有一种通用的双向循环链表,构成了各种队列的基础。链表的结构定义和相关函数均在include/linux/list.h中,下面就来全面的介绍这一链表的各种API。

[cpp] view plaincopyprint? 1. struct list_head {

2. struct list_head *next, *prev;

3. };

这是链表的元素结构。因为是循环链表,表头和表中节点都是这一结构。有prev和next两个指针,分别指向链表中前一节点和后一节点。

[cpp] view plaincopyprint? 1. #define LIST_HEAD_INIT(name) { &(name), &(name) }

2.

3. #define LIST_HEAD(name) \

4. struct list_head name = LIST_HEAD_INIT(name)

5.

6. static inline void INIT_LIST_HEAD(struct list_head *list)

7. {

8. list->next = list;

9. list->prev = list;

10. }

在初始化的时候,链表头的prev和next都是指向自身的。

[cpp] view plaincopyprint? 1. static inline void __list_add(struct list_head *new,

2. struct list_head *prev,

3. struct list_head *next)

4. {

5. next->prev = new;

6. new->next = next;

7. new->prev = prev;

8. prev->next = new;

9. }

10.

11. static inline void list_add(struct list_head *new, struct list_head *head)

12. {

第1页

你可能喜欢

热门文档

相关文档

  • linux 内核分析之list_head 双向链表结构

    linux 内核分析之 list_head 双向链表结构本文详细分析了 2.6.x 内核中链表结构的实现,并通过实例对每个链表操作接口进行了详尽的讲解。 链表数据结构简介 一、 ...

  • 深入浅出linux内核源代码之双向链表list_head(list.h)

    深入浅出 linux 内核源代码之双向链表 list_head 原创文章,转载请注明出处,谢谢! 作者:清林,博客名:飞空静渡 范金宝 email:fjb2080@163.com blog:http://blog...

  • linux2.6内核设备驱动模型精华

    linux 内核部件分析(一)——连通世界的 list 内核部件分析( ——连通世界的在...static inline void __list_add(struct list_head *new, struct list_head *...

  • linux内核head.S分析

    linux内核head.S分析_IT/计算机_专业资料。其中涉及到的文件有head.S head-...* * See linux/arch/arm/tools/mach-types for the complete list of ...

  • linux内核中的list详解

    http://blog.csdn.net/hondrif82q/archive/2007/04/14/1564893.aspx linux 内核中的 list 详解 1 list_entry 作用就是通过 list_head 型指针 ptr 换算成其...

  • Linux内核链表list_head扩展---klist

    Linux内核链表list_head扩展---klist_互联网_IT/计算机_专业资料。linux kernel看SPI 驱动核心模块时,看到用到很多 klist,之前没多深入理解,现在来一步步分析源码...

  • Linux内核源码分析

    Linux 内核源码分析-链表代码分析 分析人:余旭 分析时间:2005 年 11 月 17 ...static inline void list_add(struct list_head *new, struct list_head *...

  • Linux内核的等待队列

    linux内核中的等待队列分析... 22页 1财富值 Linux 等待队列 21页 免费 ...等待队列头 struct __wait_queue_head { wq_lock_t lock; struct list_head...

  • linux内核链表

    深入分析 Linux 内核链表... 9页 免费 Linux内核之list_head 23页 免费...内核代码赏析与应用( )-链表之实现 Linux 内核代码赏析与应用(二)-链表之实现...

  • Linux内核中的双循环链表解析

    下面我们将基于 Linux 2.4.21 分析 Linux 内核双循环链表的实现及应用。 声明和初始化 链表结构定义如下: struct list_head { struct list_head *next, *prev...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email