Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:assoc_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

Proto:struct assoc_array_edit *assoc_array_delete(struct assoc_array *array, const struct assoc_array_ops *ops, const void *index_key)

Type:struct assoc_array_edit

Parameter:

TypeParameterName
struct assoc_array *array
const struct assoc_array_ops *ops
const void *index_key
1091  pr_devel("-->%s()\n", __func__)
1093  edit = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1094  If Not edit Then Return ERR_PTR( - ENOMEM)
1096  array = array
1097  ops = ops
1098  adjust_count_by = -1
1101  Case Navigate through the internal tree looking for the closest node to the key. == assoc_array_walk_found_terminal_node
1105  pr_devel("terminal_node\n")
1106  node = Node in which leaf might be found
1109  ptr = slots[slot]
1117  Case Navigate through the internal tree looking for the closest node to the key. == assoc_array_walk_tree_empty
1118  Case Navigate through the internal tree looking for the closest node to the key. == assoc_array_walk_found_wrong_shortcut
1119  Default
1120  assoc_array_cancel_edit - Discard an edit script
1121  pr_devel("not found\n")
1122  Return NULL
1125  found_leaf :
1126  BUG_ON(nr_leaves_on_tree <= 0)
1131  dead_leaf = slots[slot]
1132  ptr = slots[slot]
1133  to = NULL
1134  adjust_count_on = node
1139  If nr_leaves_on_tree == 1 Then
1140  ptr = The node at the root of the tree
1141  to = NULL
1142  adjust_count_on = NULL
1143  excised_subtree = The node at the root of the tree
1144  pr_devel("all gone\n")
1145  Return edit
1158  If nr_leaves_on_branch <= Number of slots per node + 1 Then
1166  has_meta = false
1168  ptr = slots[i]
1169  If assoc_array_ptr_is_meta(ptr) Then
1170  has_meta = true
1171  Break
1175  pr_devel("leaves: %ld [m=%d]\n", nr_leaves_on_branch - 1, has_meta)
1181  parent = node
1182  collapse_up :
1183  pr_devel("collapse subtree: %ld\n", nr_leaves_on_branch)
1185  ptr = back_pointer
1186  If Not ptr Then Go to do_collapse
1190  ptr = back_pointer
1191  If Not ptr Then Go to do_collapse
1195  grandparent = assoc_array_ptr_to_node(ptr)
1197  parent = grandparent
1198  Go to collapse_up
1201  do_collapse :
1206  If has_meta || parent != node Then
1207  node = parent
1211  If Not new_n0 Then Go to enomem
1220  node = new_n0
1222  slot = 0
1227  pr_devel("collapsed %d,%lu\n", slot, nr_leaves_on_branch)
1230  If Not back_pointer Then
1232  Else if assoc_array_ptr_is_leaf(back_pointer) Then
1233  BUG()
1234  Else if assoc_array_ptr_is_node(back_pointer) Then
1248  Return edit
1250  enomem :
1252  pr_devel("enomem\n")
1253  assoc_array_cancel_edit - Discard an edit script
1254  Return ERR_PTR( - ENOMEM)