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

Function vnet_netgraph_uninit

freebsd/netgraph/ng_base.c:3145–3183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3143
3144#ifdef VIMAGE
3145static void
3146vnet_netgraph_uninit(const void *unused __unused)
3147{
3148 node_p node = NULL, last_killed = NULL;
3149 int i;
3150
3151 do {
3152 /* Find a node to kill */
3153 IDHASH_RLOCK();
3154 for (i = 0; i <= V_ng_ID_hmask; i++) {
3155 LIST_FOREACH(node, &V_ng_ID_hash[i], nd_idnodes) {
3156 if (node != &ng_deadnode) {
3157 NG_NODE_REF(node);
3158 break;
3159 }
3160 }
3161 if (node != NULL)
3162 break;
3163 }
3164 IDHASH_RUNLOCK();
3165
3166 /* Attempt to kill it only if it is a regular node */
3167 if (node != NULL) {
3168 if (node == last_killed) {
3169 if (node->nd_flags & NGF_REALLY_DIE)
3170 panic("ng node %s won't die",
3171 node->nd_name);
3172 /* The node persisted itself. Try again. */
3173 node->nd_flags |= NGF_REALLY_DIE;
3174 }
3175 ng_rmnode(node, NULL, NULL, 0);
3176 NG_NODE_UNREF(node);
3177 last_killed = node;
3178 }
3179 } while (node != NULL);
3180
3181 hashdestroy(V_ng_name_hash, M_NETGRAPH_NODE, V_ng_name_hmask);
3182 hashdestroy(V_ng_ID_hash, M_NETGRAPH_NODE, V_ng_ID_hmask);
3183}
3184VNET_SYSUNINIT(vnet_netgraph_uninit, SI_SUB_NETGRAPH, SI_ORDER_FIRST,
3185 vnet_netgraph_uninit, NULL);
3186#endif /* VIMAGE */

Callers

nothing calls this directly

Calls 3

ng_rmnodeFunction · 0.70
panicFunction · 0.50
hashdestroyFunction · 0.50

Tested by

no test coverage detected