400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

什么是内核对象链表结构

本篇内容介绍了“ 什么是内核对象链表结构”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创新互联建站主要从事成都网站制作、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务哈密,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575

背景

链表链接方式一

链表next指针,指向下一个对象结构体的首地址。

什么是内核对象链表结构

链表链接方式二

链表next指针,指向下一个对象结构体的链表的(next)成员。

什么是内核对象链表结构

内核对象的入口内存地址(首地址)

什么是内核对象链表结构

RT-Thread 使用:rt_list_entry

/**
 * @brief get the struct for this entry
 * @param node the entry point
 * @param type the type of structure
 * @param member the name of list in structure
 */
#define rt_list_entry(node, type, member) \
    rt_container_of(node, type, member)
/**
 * rt_container_of - return the member address of ptr, if the type of ptr is the
 * struct type.
 */
#define rt_container_of(ptr, type, member) \
    ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
type a; /* 临时变量,主要为了求成员的偏移 */

/* 成员m 的地址偏移 */
offset = &a.member - &a;

/* 假如已知结构体的某个成员m的地址ptr */

p = ptr - offset; /* ptr - (&a.m - &a)  */

“ 什么是内核对象链表结构”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


文章标题:什么是内核对象链表结构
路径分享:http://www.bluegullmedia.com/article/jhgodg.html

其他资讯

让你的专属顾问为你服务

0.0529s