Linux | 数据结构之内核链表

Linux | 数据结构之内核链表


时间:2023年12月20日15:42:45

1.参考

1.数据结构与算法教程,数据结构C语言版教程! (biancheng.net)

2.双向链表及创建(C语言)详解 (biancheng.net)

3.内核数据结构 —— 内核链表_内核链表长度怎么表示-CSDN博客

4.内核链表 - 搜索 (bing.com)

5.Linux | 内核链表-CSDN博客

6.structure/1_kernellist · cProgram/100Example - 码云 - 开源中国 (gitee.com)

2.内核链表

2-1.源码

[fly@752fac4b02e9 kernel]$ find ./ -name list.h
./include/linux/list.h
./include/config/debug/pi/list.h
./include/config/defconfig/list.h
./tools/perf/util/include/linux/list.h
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H

#ifndef ARCH_HAS_PREFETCH
#define ARCH_HAS_PREFETCH
static inline void prefetch(const void *x) {
   
   ;}
#endif

/*
 * Simple doubly linked list implementation.
 *
 * Some of the internal functions ("__xxx") are useful when
 * manipulating whole lists rather than single entries, as
 * sometimes we already know the next/prev entries and we can
 * generate better code by using them directly rather than
 * using the generic single-entry routines.
 */

struct list_head {
   
   
	struct list_head *next, *prev;
};

#define LIST_HEAD_INIT(name) {
     
      &(name), &(name) }

#define LIST_HEAD(name) \
	struct list_head name = LIST_HEAD_INIT(name)

#define INIT_LIST_HEAD(ptr) do {
     
      \
	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)

/*
 * Insert a new entry between two known consecutive entries.
 *
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 */
static inline void __list_add(struct list_head <

相关推荐

  1. Linux | 数据结构内核

    2023-12-21 22:56:02       69 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-21 22:56:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-21 22:56:02       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-21 22:56:02       87 阅读
  4. Python语言-面向对象

    2023-12-21 22:56:02       96 阅读

热门阅读

  1. C语言初学6:判断

    2023-12-21 22:56:02       59 阅读
  2. 网站访问量指标

    2023-12-21 22:56:02       55 阅读
  3. C语言求回文数(详解版)

    2023-12-21 22:56:02       60 阅读
  4. C语言三个数从小到大排序/输出

    2023-12-21 22:56:02       49 阅读
  5. netstat命令检查端口是否监听

    2023-12-21 22:56:02       57 阅读
  6. IEEE双栏摘要排版

    2023-12-21 22:56:02       55 阅读
  7. CCF编程能力等级认证GESP—C++5级—20230923

    2023-12-21 22:56:02       85 阅读
  8. 阿里lindorm与MyBatis Plus集成

    2023-12-21 22:56:02       63 阅读
  9. Scrum项目管理流程及免费敏捷工具

    2023-12-21 22:56:02       78 阅读