MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pctrie_node_get

Function pctrie_node_get

freebsd/kern/subr_pctrie.c:98–122  ·  view source on GitHub ↗

* Allocate a node. Pre-allocation should ensure that the request * will always be satisfied. */

Source from the content-addressed store, hash-verified

96 * will always be satisfied.
97 */
98static struct pctrie_node *
99pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t allocfn, uint64_t owner,
100 uint16_t count, uint16_t clevel)
101{
102 struct pctrie_node *node;
103
104 node = allocfn(ptree);
105 if (node == NULL)
106 return (NULL);
107
108 /*
109 * We want to clear the last child pointer after the final section
110 * has exited so lookup can not return false negatives. It is done
111 * here because it will be cache-cold in the dtor callback.
112 */
113 if (node->pn_last != 0) {
114 pctrie_node_store(&node->pn_child[node->pn_last - 1], NULL,
115 PCTRIE_UNSERIALIZED);
116 node->pn_last = 0;
117 }
118 node->pn_owner = owner;
119 node->pn_count = count;
120 node->pn_clev = clevel;
121 return (node);
122}
123
124/*
125 * Free radix node.

Callers 1

pctrie_insertFunction · 0.85

Calls 1

pctrie_node_storeFunction · 0.85

Tested by

no test coverage detected