zoukankan      html  css  js  c++  java
  • Linux中的链表

    笔记:<<the linux kernel primer>>

    linux中的链表常见的是循环双向链表。其完整代码存放在同文件include/linux/list.h中

     1 include/linux/list.h
     2 
     3 struct list_head {
     4     struct list_head *next,*prev;
     5 };
     6 
     7 #define LIST_HEAD_INIT(name) { &(name),&(name)}
     8 
     9 #define LIST_HEAD(name) 
    10     struct list_head name = LIST_HEAD_INIT(name)//根据链表的名字创建表头
    11 
    12 #define INIT_LIST_HEAD(ptr) do {               //将头节点中的prev和next指针都指向头节点本身,完成这两个宏调用后name就指向了一个空链表:(头节点的next
    13     (ptr)->next = (ptr);(ptr)->prev = (ptr);    //指向该链表的表头元素本身)
    14 } while (0) 
  • 相关阅读:
    Fusion access
    组网架构
    DHCP中继
    Vxlan配置
    redis多实例
    ansible实现redis角色
    ansible如何ssh免密链接(基于key验证)
    MySQL主从复制
    MySQL范例
    Ubuntu2004安装
  • 原文地址:https://www.cnblogs.com/gaocan/p/5325127.html
Copyright © 2011-2022 走看看