函数逻辑报告 |
Source Code:lib\assoc_array.c |
Create Date:2022-07-27 07:51:37 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:assoc_array_gc - Garbage collect an associative array
函数原型:int assoc_array_gc(struct assoc_array *array, const struct assoc_array_ops *ops, bool (*iterator)(void *object, void *iterator_data), void *iterator_data)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct assoc_array * | array | |
const struct assoc_array_ops * | ops | |
bool (* | iterator | |
void * | iterator_data |
1469 | 如果非The node at the root of the tree 则返回:0 |
1477 | ops_for_excised_subtree等于ops |
1481 | new_root = new_parent = NULL |
1482 | new_ptr_pp等于new_root |
1485 | descend : |
1489 | 如果assoc_array_ptr_is_shortcut(cursor)则 |
1492 | keylen右移等于ASSOC_ARRAY_KEY_CHUNK_SHIFT位 |
1493 | new_s等于kmalloc(sizeof(structassoc_array_shortcut) + keylen * sizeof(unsignedlong), GFP_KERNEL) |
1500 | back_pointer等于new_parent |
1501 | parent_slot等于parent_slot |
1503 | new_ptr_pp等于next_node |
1508 | node等于assoc_array_ptr_to_node(cursor) |
1513 | back_pointer等于new_parent |
1514 | parent_slot等于parent_slot |
1516 | new_ptr_pp = NULL |
1517 | slot等于0 |
1519 | continue_node : |
1521 | 以slot小于Number of slots per node 循环 |
1523 | 如果非ptr则继续下一循环 |
1526 | 如果assoc_array_ptr_is_leaf(ptr)则 |
1527 | 如果iterator(assoc_array_ptr_to_leaf(ptr), iterator_data)则slots[slot]等于ptr |
1533 | 继续下一循环 |
1536 | new_ptr_pp等于slots[slot] |
1538 | 转到:descend |
1546 | nr_leaves_on_branch等于0 |
1547 | nr_free等于0 |
1548 | 以slot小于Number of slots per node 循环 |
1552 | 否则如果assoc_array_ptr_is_leaf(ptr)则nr_leaves_on_branch自加 |
1555 | 打印调试信息("free=%d, leaves=%lu\n", nr_free, nr_leaves_on_branch) |
1558 | next_slot等于0 |
1559 | 以slot小于Number of slots per node 循环 |
1564 | 如果非ptr或assoc_array_ptr_is_leaf(ptr)则继续下一循环 |
1567 | s = NULL |
1568 | 如果assoc_array_ptr_is_shortcut(ptr)则 |
1569 | s等于assoc_array_ptr_to_shortcut(ptr) |
1573 | child等于assoc_array_ptr_to_node(ptr) |
1576 | 如果nr_leaves_on_branch小于等于nr_free加1则 |
1578 | 打印调试信息("[%d] fold node %lu/%d [nx %d]\n", slot, nr_leaves_on_branch, nr_free + 1, next_slot) |
1588 | nr_free自加 |
1591 | 以i小于Number of slots per node 循环 |
1593 | 如果非p则继续下一循环 |
1595 | BUG_ON(assoc_array_ptr_is_meta(p)) |
1597 | next_slot自加 |
1598 | BUG_ON(next_slot >= Number of slots per node ) |
1600 | nr_free自减 |
1603 | 否则 |
1604 | 打印调试信息("[%d] retain node %lu/%d [nx %d]\n", slot, nr_leaves_on_branch, nr_free + 1, next_slot) |
1610 | 打印调试信息("after: %lu\n", nr_leaves_on_branch) |
1615 | 如果nr_free恒等于Number of slots per node 减1则 |
1618 | 退出 |
1623 | new_s等于assoc_array_ptr_to_shortcut(ptr) |
1624 | new_parent等于back_pointer |
1625 | slot等于parent_slot |
1627 | 如果非new_parent则 |
1634 | 如果assoc_array_ptr_is_shortcut(new_parent)则 |
1639 | 打印调试信息("excise preceding shortcut\n") |
1641 | new_parent等于back_pointer等于back_pointer |
1642 | slot等于parent_slot等于parent_slot |
1644 | 如果非new_parent则 |
1652 | back_pointer等于new_parent |
1653 | parent_slot等于slot |
1656 | 转到:ascend_old_tree |
1663 | ptr等于back_pointer |
1664 | 如果非ptr则转到:gc_complete |
1667 | 如果assoc_array_ptr_is_shortcut(ptr)则 |
1668 | new_s等于assoc_array_ptr_to_shortcut(ptr) |
1669 | new_parent等于back_pointer |
1670 | slot等于parent_slot |
1672 | 如果nr_leaves_on_branch小于等于Number of slots per node 则 |
1675 | 打印调试信息("excise shortcut\n") |
1676 | back_pointer等于new_parent |
1677 | parent_slot等于slot |
1679 | 如果非new_parent则 |
1680 | new_root等于assoc_array_node_to_ptr(new_n) |
1681 | 转到:gc_complete |
1684 | n等于assoc_array_ptr_to_node(new_parent) |
1685 | slots[slot]等于assoc_array_node_to_ptr(new_n) |
1687 | 否则 |
1688 | new_parent等于ptr |
1692 | ascend_old_tree : |
1693 | ptr等于back_pointer |
1694 | 如果assoc_array_ptr_is_shortcut(ptr)则 |
1700 | 否则 |
1701 | slot等于parent_slot |
1705 | node等于assoc_array_ptr_to_node(cursor) |
1706 | slot自加 |
1707 | 转到:continue_node |
1709 | gc_complete : |
1713 | 返回:0 |
1715 | enomem : |
1716 | 打印调试信息("enomem\n") |
1719 | 返回:负ENOMEM |
名称 | 描述 |
---|---|
keyring_gc | Garbage collect pointers from a keyring.* Not called with any locks held. The keyring's key struct will not be* deallocated under us as only our caller may deallocate it. |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |