Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\assoc_array.c Create Date:2022-07-28 06:54:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Iterate over an associative array. The caller must hold the RCU read lock* or better.

Proto:static int assoc_array_subtree_iterate(const struct assoc_array_ptr *root, const struct assoc_array_ptr *stop, int (*iterator)(const void *leaf, void *iterator_data), void *iterator_data)

Type:int

Parameter:

TypeParameterName
const struct assoc_array_ptr *root
const struct assoc_array_ptr *stop
int (*iterator
void *iterator_data
31  cursor = root
33  begin_node :
34  If assoc_array_ptr_is_shortcut(cursor) Then
36  shortcut = assoc_array_ptr_to_shortcut(cursor)
37  cursor = READ_ONCE(next_node)
40  node = assoc_array_ptr_to_node(cursor)
41  slot = 0
50  has_meta = 0
51  When slot < Number of slots per node cycle
52  ptr = READ_ONCE(slots[slot])
53  has_meta |= ptr
54  If ptr && assoc_array_ptr_is_leaf(ptr) Then
61  If ret Then Return ret
74  If Not (has_meta & Points to node or shortcut ) Then Go to finished_node
76  slot = 0
78  continue_node :
79  node = assoc_array_ptr_to_node(cursor)
80  When slot < Number of slots per node cycle
81  ptr = READ_ONCE(slots[slot])
83  cursor = ptr
84  Go to begin_node
88  finished_node :
90  parent = READ_ONCE(back_pointer)
91  slot = parent_slot
92  If parent == stop Then Return 0
95  If assoc_array_ptr_is_shortcut(parent) Then
96  shortcut = assoc_array_ptr_to_shortcut(parent)
97  cursor = parent
98  parent = READ_ONCE(back_pointer)
99  slot = parent_slot
100  If parent == stop Then Return 0
105  cursor = parent
106  slot++
107  Go to continue_node
Caller
NameDescribe
assoc_array_iterateassoc_array_iterate - Pass all objects in the array to a callback*@array: The array to iterate over.*@iterator: The callback function.*@iterator_data: Private data for the callback function.* Iterate over all the objects in an associative array
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