* Allocate a node. Pre-allocation should ensure that the request * will always be satisfied. */
| 96 | * will always be satisfied. |
| 97 | */ |
| 98 | static struct pctrie_node * |
| 99 | pctrie_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. |
no test coverage detected