函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_list_sort.c Create Date:2022-07-27 07:27:14
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:list_sort_test

函数原型:static int __init list_sort_test(void)

返回类型:int

参数:

72  count等于1, err等于负ENOMEM
75  LIST_HEAD(head)
77  pr_debug("start testing list_sort()\n")
79  Array, containing pointers to all elements in the test list 等于分配数组内存并置零
80  如果非Array, containing pointers to all elements in the test list 则返回:err
83 i小于 including head 循环
84  el等于kmalloc(el的长度, GFP_KERNEL)
85  如果非el则转到:exit
89  value等于prandom_u32()取模 including head 除3
90  serial等于i
91  poison1等于TEST_POISON1
92  poison2等于TEST_POISON2
93  Array, containing pointers to all elements in the test list [i]等于el
94  添加链表项
97  list_sort - sort a list*@priv: private data, opaque to list_sort(), passed to @cmp*@head: the list to sort*@cmp: the elements comparison function* The comparison funtion @cmp must return > 0 if @a should sort after*@b ("@a > @b" if you want an ascending
99  err等于负EINVAL
100 链表后项不等于head循环
104  如果链表前项不等于cur
105  打印错误信息("error: list is corrupted\n")
106  转到:exit
109  cmp_result等于cmp(NULL, cur, 链表后项)
110  如果cmp_result大于0则
111  打印错误信息("error: list is not sorted\n")
112  转到:exit
115  el等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(cur, structdebug_el, list)
116  el1等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(链表后项, structdebug_el, list)
117  如果cmp_result恒等于0且serial大于等于serial
118  打印错误信息("error: order of equivalent elements not preserved\n")
120  转到:exit
123  如果check(el, el1)则
124  打印错误信息("error: element check failed\n")
125  转到:exit
127  count自加
129  如果prev不等于cur
130  打印错误信息("error: list is corrupted\n")
131  转到:exit
135  如果count不等于 including head
136  打印错误信息("error: bad list length %d", count)
137  转到:exit
140  err等于0
141  exit :
142 i小于 including head 循环kfree(Array, containing pointers to all elements in the test list [i])
144  kfree(Array, containing pointers to all elements in the test list )
145  返回:err