函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Navigate through the internal tree looking for the closest node to the key.

函数原型:static enum assoc_array_walk_status assoc_array_walk(const struct assoc_array *array, const struct assoc_array_ops *ops, const void *index_key, struct assoc_array_walk_result *result)

返回类型:enum assoc_array_walk_status

参数:

类型参数名称
const struct assoc_array *array
const struct assoc_array_ops *ops
const void *index_key
struct assoc_array_walk_result *result
183  打印调试信息("-->%s()\n", __func__)
185  cursor等于READ_ONCE(The node at the root of the tree )
186  如果非cursor则返回:assoc_array_walk_tree_empty
189  level等于0
198  jumped :
199  segments等于get_key_chunk(index_key, level)
200  打印调试信息("segments[%d]: %lx\n", level, segments)
202  如果assoc_array_ptr_is_shortcut(cursor)则转到:follow_shortcut
205  consider_node :
206  node等于assoc_array_ptr_to_node(cursor)
207  slot等于segments右移level按位与ASSOC_ARRAY_KEY_CHUNK_MASK的值位
208  slot与等于ASSOC_ARRAY_FAN_MASK
209  ptr等于READ_ONCE(slots[slot])
211  打印调试信息("consider slot %x [ix=%d type=%lu]\n", slot, level, (unsignedlong)ptr & 3)
214  如果非assoc_array_ptr_is_meta(ptr)则
218  Node in which leaf might be found 等于node
219  level等于level
220  slot等于slot
221  打印调试信息("<--%s() = terminal_node\n", __func__)
222  返回:assoc_array_walk_found_terminal_node
225  如果assoc_array_ptr_is_node(ptr)则
229  cursor等于ptr
230  level加等于ASSOC_ARRAY_LEVEL_STEP
231  如果level按位与ASSOC_ARRAY_KEY_CHUNK_MASK的值不等于0则转到:consider_node
233  转到:jumped
240  cursor等于ptr
241  follow_shortcut :
242  shortcut等于assoc_array_ptr_to_shortcut(cursor)
243  打印调试信息("shortcut to %d\n", skip_to_level)
244  sc_level等于levelASSOC_ARRAY_LEVEL_STEP
245  BUG_ON(sc_level > skip_to_level)
247  循环
252  如果sc_level按位与ASSOC_ARRAY_KEY_CHUNK_MASK的值恒等于0则segments等于get_key_chunk(index_key, sc_level)
255  sc_segments等于index_key[sc_level >> ASSOC_ARRAY_KEY_CHUNK_SHIFT]
256  dissimilarity等于segments按位异或sc_segments
261  dissimilarity与等于ULONG_MAX左移shift位的值的反
263  否则
268  如果dissimilarity不等于0则
270  shortcut等于shortcut
271  level等于level
272  sc_level等于sc_level
278  sc_level等于next_sc_level
279 sc_level小于skip_to_level循环
282  cursor等于READ_ONCE(next_node)
283  如果level按位异或sc_level的值按位与ASSOC_ARRAY_KEY_CHUNK_MASK的反的值不等于0则
284  level等于sc_level
285  转到:jumped
286  否则
287  level等于sc_level
288  转到:consider_node
调用者
名称描述
assoc_array_findassoc_array_find - Find an object by index key*@array: The associative array to search
assoc_array_insertassoc_array_insert - Script insertion of an object into an associative array*@array: The array to insert into
assoc_array_deleteassoc_array_delete - Script deletion of an object from an associative array*@array: The array to search.*@ops: The operations to use.*@index_key: The key to the object.* Precalculate and preallocate a script for the deletion of an object from an