MCPcopy Index your code
hub / github.com/F-Stack/f-stack / vnet_netgraph_uninit

Function vnet_netgraph_uninit

lib/ff_ng_base.c:3169–3207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3167
3168#ifdef VIMAGE
3169static void
3170vnet_netgraph_uninit(const void *unused __unused)
3171{
3172 node_p node = NULL, last_killed = NULL;
3173 int i;
3174
3175 do {
3176 /* Find a node to kill */
3177 IDHASH_RLOCK();
3178 for (i = 0; i <= V_ng_ID_hmask; i++) {
3179 LIST_FOREACH(node, &V_ng_ID_hash[i], nd_idnodes) {
3180 if (node != &ng_deadnode) {
3181 NG_NODE_REF(node);
3182 break;
3183 }
3184 }
3185 if (node != NULL)
3186 break;
3187 }
3188 IDHASH_RUNLOCK();
3189
3190 /* Attempt to kill it only if it is a regular node */
3191 if (node != NULL) {
3192 if (node == last_killed) {
3193 if (node->nd_flags & NGF_REALLY_DIE)
3194 panic("ng node %s won't die",
3195 node->nd_name);
3196 /* The node persisted itself. Try again. */
3197 node->nd_flags |= NGF_REALLY_DIE;
3198 }
3199 ng_rmnode(node, NULL, NULL, 0);
3200 NG_NODE_UNREF(node);
3201 last_killed = node;
3202 }
3203 } while (node != NULL);
3204
3205 hashdestroy(V_ng_name_hash, M_NETGRAPH_NODE, V_ng_name_hmask);
3206 hashdestroy(V_ng_ID_hash, M_NETGRAPH_NODE, V_ng_ID_hmask);
3207}
3208VNET_SYSUNINIT(vnet_netgraph_uninit, SI_SUB_NETGRAPH, SI_ORDER_FIRST,
3209 vnet_netgraph_uninit, NULL);
3210#endif /* VIMAGE */

Callers

nothing calls this directly

Calls 3

panicFunction · 0.70
ng_rmnodeFunction · 0.70
hashdestroyFunction · 0.70

Tested by

no test coverage detected