当前位置: 首页 > news >正文

常见的网站推广方法有哪些网络架构指什么

常见的网站推广方法有哪些,网络架构指什么,免费做长图网站,网络开发部是做什么的内核链表list.h文件剖析 一、内核链表的结构【双向循环链表】 内核链表的好主要体现为两点#xff0c;1是可扩展性#xff0c;2是封装。可以将内核链表复用到用户态编程中#xff0c;以后在用户态下编程就不需要写一些关于链表的代码了#xff0c;直接将内核中list.h中的代…  内核链表list.h文件剖析 一、内核链表的结构【双向循环链表】 内核链表的好主要体现为两点1是可扩展性2是封装。可以将内核链表复用到用户态编程中以后在用户态下编程就不需要写一些关于链表的代码了直接将内核中list.h中的代码拷贝过来用。 struct list_head {struct list_head *next, *prev; }; // 包含了两个指向list_head结构体的指针next,prev[后驱和前驱] 二、内核链表常用接口 1、INIT_LIST_HEAD创建链表 2、list_add在prev和next之间插入结点 3、list_add_tail在链表尾插入结点 4、list_del删除结点 5、list_entry取出结点 6、list_for_each遍历链表 【推荐看使用sourceInsight查看代码】 三、深入分析list.h 1、offsetof【在已知某一个成员变量的名字和结构体类型的情况下计算该成员相对于结构体的起始地址的偏移量】 #ifdef __compiler_offsetof #define offsetof(TYPE,MEMBER)__compiler_offsetof(TYPE,MEMBER) #else #ifndef offsetof #define offsetof(type, member) ((size_t) ((type*)0)-member) #endif 2、container_of【已知某一个成员变量的名字、指针和结构体类型的情况下计算结构体的指针也就是计算结构体的起始地址】 #define container_of(ptr, type, member) ({ \const typeof(((type *)0)-member ) *__mptr (ptr); \(type *)((char *)__mptr - offsetof(type,member) );}) 3、LIST_HEAD_INIT【初始化一个结点名字为name的双向循环链表的头结点】 #define LIST_HEAD_INIT(name) { (name),(name) } 4、LIST_HEAD【初始化一个结点名字为name的双向循环链表的头结点】 #define LIST_HEAD(name) \struct list_head name LIST_HEAD_INIT(name) 5、INIT_LIST_HEAD【初始化链表节点将next和prev指针都指向其自身我们就构造了一个空的双循环链表。】 static __INLINE__ void INIT_LIST_HEAD(struct list_head *list) {list-next list;list-prev list; } 6、list_add【在头结点后加一个新结点】 #ifndef CONFIG_DEBUG_LIST static __INLINE__ void __list_add(struct list_head *new,struct list_head *prev,struct list_head *next) {next-prev new;new-next next;new-prev prev;prev-next new; } #else extern void __list_add(struct list_head *new,struct list_head *prev,struct list_head *next); #endifstatic __INLINE__ void list_add(struct list_head *new,struct list_head *head) {__list_add(new, head, head-next); } 7、list_add_tail【添加结点new到链表尾】 static __INLINE__ void list_add_tail(struct list_head *new, struct list_head *head) {__list_add(new, head-prev, head); } // 在head-prev和head之间加入new即在链表尾加入new结点 8、list_del【list_del将会将该节点与外界的“联系”切断然后就可以使用free释放了如果是内核态就用kfree或vfree】 #define LIST_POISON1 0 #define LIST_POISON2 0static __INLINE__ void __list_del(struct list_head *prev, struct list_head * next) {next-prev prev;prev-next next; }#ifndef CONFIG_DEBUG_LIST static __INLINE__ void list_del(struct list_head *entry) {__list_del(entry-prev, entry-next);entry-next LIST_POISON1;entry-prev LIST_POISON2; } #else extern void list_del(struct list_head *entry); #endif 9、list_replace【用结点new替换结点old】 static __INLINE__ void list_replace(struct list_head *old,struct list_head *new) {new-next old-next;new-next-prev new;new-prev old-prev;new-prev-next new; } 10、 list_replace_init【用结点new替换结点old并初始化old】 static __INLINE__ void list_replace_init(struct list_head *old,struct list_head *new) {list_replace(old, new);INIT_LIST_HEAD(old); } 11、list_del_init【删除结点entry并初始化entry】 static __INLINE__ void list_del_init(struct list_head*entry) {__list_del(entry-prev, entry-next);INIT_LIST_HEAD(entry); } 12、list_move【先将list节点从原链表中删除然后将其添加到head链表的表头】 static __INLINE__ void list_move(struct list_head *list, struct list_head *head) {__list_del(list-prev, list-next);list_add(list,head); } 13、list_move_tail【先将list节点从原链表中删除然后将其添加到head链表的表尾】 static __INLINE__ void list_move_tail(struct list_head *list,struct list_head *head) {__list_del(list-prev, list-next);list_add_tail(list, head); } 14、list_is_last【测试list节点是否为head链表的表尾节点。是返回1否则返回0】 static __INLINE__ int list_is_last(const struct list_head *list,const struct list_head *head) {return list-next head; } 15、list_empty【判断head链表是否为空链表是返回1否则返回为0】 static __INLINE__ int list_empty(const struct list_head *head) {return head-next head; }16、list_empty_careful【判断节点head的前驱和后驱是否都指向head。是返回1否则返回0】 static __INLINE__ int list_empty_careful(const structlist_head *head) {struct list_head *next head-next;return (next head) (next head-prev); } 17、list_rotate_left【函数每次将头结点后的一个结点放到head链表的末尾直到head结点后没有其他结点】 static __INLINE__ void list_rotate_left(struct list_head *head) {struct list_head *first;if(!list_empty(head)){first head-next;list_move_tail(first, head);} } 18、list_is_singular【判断head链表是否为单节点链表。是返回1否为0】 static __INLINE__ int list_is_singular(const struct list_head *head) {return !list_empty(head) (head-next head-prev); } 19、__list_cut_position【这个函数是将head链表的头结点至entry节点之间的节点连在list节点后面即组成以list节点为头结点的新链表】 static __INLINE__ void __list_cut_position(struct list_head *list,struct list_head *head, struct list_head *entry) {struct list_head *new_first entry-next;list-next head-next;list-next-prev list;list-prev entry;entry-next list;head-next new_first;new_first-prev head; }span stylefont-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); /span 20、list_cut_position【与__list_cut_position功能相似不过要先判断链表head是否为空链表再判断是否为了单链表而且节点不是entry的情况如果headentry直接初始化list】 static __INLINE__ void list_cut_position(struct list_head *list,struct list_head *head, struct list_head *entry) {if(list_empty(head)){return;}if(list_is_singular(head) (head-next ! entry head ! entry)){return;}if (entry head){INIT_LIST_HEAD(list);}else{__list_cut_position(list, head, entry);} } 21、__list_splice【将list链表的全部节点头节点list除外插入在prev和next节点之间】 static __INLINE__ void __list_splice(const struct list_head *list,struct list_head *prev,struct list_head *next) {struct list_head *first list-next;struct list_head *last list-prev;first-prev prev;prev-next first;last-next next;next-prev last; } 22、list_splice_tail【在list是非空链表的情况下将其插在head链表的尾部即head节点的前面】 static __INLINE__ void list_splice_tail(struct list_head *list,struct list_head *head) {if(!list_empty(list)){__list_splice(list, head-prev, head);} } 23、list_splice_init【在list是非空链表的情况下将其插在head链表的尾部即head节点的前面。然后对list节点进行初始化排除不安全因素】 static __INLINE__ void list_splice_init(struct list_head *list,struct list_head *head) {if(!list_empty(list)){__list_splice(list, head, head-next);INIT_LIST_HEAD(list);} } 24、list_splice_tail_init【在list是非空链表的情况下将其插在head链表的尾部即head节点的前面。然后对list节点进行初始化排除不安全因素】 static __INLINE__ void list_splice_tail_init(struct list_head *list, struct list_head *head) {if(!list_empty(list)){__list_splice(list, head-prev, head);INIT_LIST_HEAD(list);} } 25、list_entry【获取type类型结构体的起始指针】 #define list_entry(ptr, type, member) \container_of(ptr, type, member) 26、list_first_entry【已知type类型的结构体中member成员的指针后求得它所在的链表的下一个指针所指的member所在的type类型的结构体的起始地址】 #define list_first_entry(ptr, type, member) \list_entry((ptr)-next, type, member) 27、list_for_each【从head节点开始不包括head节点遍历它的每一个节点】 #define list_for_each(pos, head) \for (pos (head)-next; prefetch(pos-next), pos ! (head); \pos pos-next) 28、list_for_each_prev【它也是从head节点开始不包括head节点向前遍历每一个节点即从链表的尾部开始遍历】 #define list_for_each_prev(pos, head) \for (pos (head)-prev; prefetch(pos-prev), pos ! (head); \pos pos-prev) 29、list_for_each_safe【从head节点开始不包括head节点遍历它的每一个节点它用n先将下一个要遍历的节点保存起来防止删除本节点后无法找到下一个节点而出现错误】 #define list_for_each_safe(pos, n, head) \for (pos (head)-next, n pos-next; pos ! (head); \pos n, n pos-next) 30、list_for_each_prev_safe【它也是从head节点开始不包括head节点向前遍历每一个节点即从链表的尾部开始遍历】 #define list_for_each_prev_safe(pos, n, head) \for (pos (head)-prev, n pos-prev; \prefetch(pos-prev), pos ! (head); \pos n,n pos-prev) 31、list_for_each_entry【已知指向某个结构体的指针pos以及指向它中member成员的指针head从下一个结构体开始向后遍历这个结构体链】 #define list_for_each_entry(pos, head, member) \for (pos list_entry((head)-next, typeof(*pos), member); \prefetch(pos-member.next), pos-member ! (head); \pos list_entry(pos-member.next,typeof(*pos), member)) 32、list_for_each_entry_reverse【已知指向某个结构体的指针pos以及指向它中member成员的指针head从下一个结构体开始向前遍历这个结构体链】 #define list_for_each_entry_reverse(pos, head,member) \for (pos list_entry((head)-prev, typeof(*pos), member); \prefetch(pos-member.prev), pos-member ! (head); \pos list_entry(pos-member.prev, typeof(*pos), member)) 33、list_prepare_entry【判断pos这个指针是否为空为空的话给它赋值list_entry(head, typeof(*pos), member)这条语句求出来的结构体的地址】 #define list_prepare_entry(pos, head, member) \((pos) ? :list_entry(head, typeof(*pos), member)) 34、list_for_each_entry_continue【已知指向某个结构体的指针pos以及指向它中的member成员的head指针从它的下一个结构体开始向后遍历这个链表】 #define list_for_each_entry_continue(pos, head,member) \for (pos list_entry(pos-member.next, typeof(*pos), member); \prefetch(pos-member.next), pos-member ! (head); \pos list_entry(pos-member.next, typeof(*pos), member)) 35、list_for_each_entry_continue_reverse【已知指向某个结构体的指针pos以及指向它中的member成员的head指针从它的前一个结构体开始向前遍历这个链表】 #define list_for_each_entry_continue_reverse(pos,head, member) \for (pos list_entry(pos-member.prev, typeof(*pos), member); \prefetch(pos-member.prev), pos-member ! (head); \pos list_entry(pos-member.prev, typeof(*pos), member)) 36、list_for_each_entry_from【从pos节点开始向后遍历链表】 #define list_for_each_entry_from(pos, head,member) \for (;prefetch(pos-member.next), pos-member ! (head); \pos list_entry(pos-member.next, typeof(*pos), member)) 37、list_for_each_entry_safe【先保存下一个要遍历的节点从head下一个节点向后遍历链表】 #define list_for_each_entry_safe(pos, n, head,member) \for (pos list_entry((head)-next, typeof(*pos), member), \n list_entry(pos-member.next, typeof(*pos), member); \pos-member ! (head); \pos n,n list_entry(n-member.next, typeof(*n), member)) 38、list_for_each_entry_safe_continue【先保存下一个要遍历的节点从pos下一个节点向后遍历链表】 #define list_for_each_entry_safe_continue(pos, n, head,member) \for (pos list_entry(pos-member.next, typeof(*pos), member), \n list_entry(pos-member.next, typeof(*pos), member); \pos-member ! (head); \pos n,n list_entry(n-member.next, typeof(*n), member)) 39、list_for_each_entry_safe_from【先保存下一个要遍历的节点从pos节点向后遍历链表】 #define list_for_each_entry_safe_from(pos, n, head,member) \for (n list_entry(pos-member.next, typeof(*pos), member); \pos-member ! (head); \pos n, n list_entry(n-member.next,typeof(*n), member)) 40、list_for_each_entry_safe_reverse【先保存下一个要遍历的节点从链表尾部向前遍历链表】 #define list_for_each_entry_safe_reverse(pos, n, head,member) \for (pos list_entry((head)-prev, typeof(*pos), member), \n list_entry(pos-member.prev, typeof(*pos), member); \pos-member ! (head); \pos n,n list_entry(n-member.prev, typeof(*n), member)) 41、list_safe_reset_next【获取n结构体指针】 #define list_safe_reset_next(pos, n, member) \n list_entry(pos-member.next, typeof(*pos), member) // hash链表头 struct hlist_head {structh list_node *first; };struct hlist_node {struct hlist_node *next, **pprev; }; 1、INIT_HLIST_HEAD【初始化头节点指针ptr】 #define INIT_HLIST_HEAD(ptr) ((ptr)-first NULL) 2、INIT_HLIST_NODE【初始化hlist节点】 static __INLINE__ void INIT_HLIST_NODE(struct hlist_node *h) {h-next NULL;h-pprev NULL; } 3、hlist_unhashed【判断h-pprev是否为空是返回1否返回0】 static __INLINE__ int hlist_unhashed(const struct hlist_node *h) {return !h-pprev; } 4、hlist_empty【判断hlist是否为空是返回1否返回0】 static __INLINE__ int hlist_empty(const struct hlist_head *h) {return !h-first; } 5、__hlist_del【删除结点n】 static __INLINE__ void __hlist_del(struct hlist_node*n) {struct hlist_node *next n-next;struct hlist_node **pprev n-pprev;*pprev next;if (next){next-pprev pprev;} } 6、hlist_del【删除结点n将结点next、pprev分别指向LIST_POISON1、LIST_POISON2。这样设置是为了保证不在链表中的结点项不能被访问】 static __INLINE__ void hlist_del(struct hlist_node *n) {__hlist_del(n);n-next LIST_POISON1;n-pprev LIST_POISON2; } 7、hlist_del_init【先判断结点是否为空不为空删除再初始化节点】 static __INLINE__ void hlist_del_init(struct hlist_node *n) {if(!hlist_unhashed(n)){__hlist_del(n);INIT_HLIST_NODE(n);} } 8、hlist_add_head【增加结点n到h表头】 static __INLINE__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h) {struct hlist_node *first h-first;n-next first;if (first){first-pprev n-next;}h-first n;n-pprev h-first; }span stylefont-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); /span 9、hlist_add_before【增加结点n到结点next之前】 /* next must be ! NULL */ static __INLINE__ void hlist_add_before(struct hlist_node *n,struct hlist_node *next) {n-pprev next-pprev;n-next next;next-pprev n-next;*(n-pprev) n; } 10、hlist_add_after【增加结点n到结点next之后】 static __INLINE__ void hlist_add_after(struct hlist_node *n,struct hlist_node *next) {next-next n-next;n-next next;next-pprev n-next;if(next-next){next-next-pprev next-next;} } 11、hlist_move_list【头结点new接管头结点old的所有节点并初始化old】 static __INLINE__ void hlist_move_list(struct hlist_head *old,struct hlist_head *new) {new-first old-first;if(new-first){new-first-pprev new-first;}old-first NULL; } 12、hlist_entry【已知某一个成员变量的名字、指针和结构体类型的情况下计算结构体的指针也就是计算结构体的起始地址】 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)13、hlist_for_each【遍历hlist链表】 #define hlist_for_each(pos, head) \for (pos (head)-first; pos ; \pos pos-next) 14、 hlist_for_each_safe【遍历hlist链表一般在删除结点使用】 #define hlist_for_each_safe(pos, n, head) \for (pos (head)-first; pos ({ n pos-next; 1; }); \pos n) 15、hlist_for_each_entry【遍历找typeof(*tpos)的结构体类型入口地址】 #define hlist_for_each_entry(tpos, pos, head,member) \for (pos (head)-first; \pos ({ prefetch(pos-next); 1;}) \({ tpos hlist_entry(pos, typeof(*tpos), member); 1;}); \pos pos-next) 16、hlist_for_each_entry_continue【从结点pos下一个遍历找typeof(*tpos)的结构体类型入口地址】 #define hlist_for_each_entry_continue(tpos, pos,member) \for (pos (pos)-next; \pos ({ prefetch(pos-next); 1;}) \({ tpos hlist_entry(pos, typeof(*tpos), member); 1;}); \pos pos-next) 17、hlist_for_each_entry_from【从节点pos开始遍历找typeof(*tpos)的结构体类型入口地址】 #define hlist_for_each_entry_from(tpos, pos,member) \for (; pos ({ prefetch(pos-next); 1;}) \({ tpos hlist_entry(pos, typeof(*tpos), member); 1;}); \pos pos-next) 18、hlist_for_each_entry_safe【从头节点head开始遍历找typeof(*tpos)的结构体类型入口地址】 #define hlist_for_each_entry_safe(tpos, pos, n, head,member) \for (pos (head)-first; \pos ({ n pos-next; 1; }) \({ tpos hlist_entry(pos, typeof(*tpos), member); 1;}); \pos n)
http://www.yutouwan.com/news/107073/

相关文章:

  • 网站建设一般的费用企业网站 多网站推广
  • 宁波三优互动网站建设公司怎么样做药的常用网站
  • wordpress 前台优酷视频自适应北京seo专员
  • 软件属于网站开发吗北京有名的设计公司有哪些
  • 手机网站建设推广方案ppt企业画册封面设计
  • 做网站表格单边框标记免费软件app有哪些
  • 做网站找哪家公司最好网站服务器天付
  • iis 发布asp网站云主机 网站指南
  • pc 移动 网站开发动态ip怎么做网站
  • 网站1g空间多少钱网站开发模式
  • 母婴网站建设wordpress 更改首页
  • 大名做网站网站常用配色
  • 网站备案照片背景免费做快闪网站
  • 酒店网站建设研究哪家网站建设做的好
  • 营销管理网站定制wordpress
  • 网站怎么做搜索引擎优化_凡客下载
  • 京东网站建设的特点三亚做网站
  • php网站源码删除小说网站充值接口怎么做的
  • 网站设计小图标大作业做网站
  • 建设银行签名通在网站哪里下载百度app小程序
  • 网站建设费往什么科目常见购物网站功能
  • 网站seo优化推广怎么做wordpress 随机读取一篇文章
  • 厦门建网站的公司wordpress 三栏怎么弄
  • 网站logo是什么意思合肥网站建设网站制作
  • 厦门外贸建站更改网站模板内容
  • 中山哪里有好网站建设公司如何做网站搜索栏
  • 网上商城网站源码建设单位发包许可证网站
  • 地产网站互动设计网站备案个人信息泄露
  • 网站正在建设中的网页怎么做垦利网站建设
  • 湘潭做网站 去磐石网络企企业业网网站站建建设设