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

Function ng_ID_rehash

freebsd/netgraph/ng_base.c:1007–1033  ·  view source on GitHub ↗

* Allocate a bigger ID hash. */

Source from the content-addressed store, hash-verified

1005 * Allocate a bigger ID hash.
1006 */
1007static void
1008ng_ID_rehash()
1009{
1010 struct nodehash *new;
1011 uint32_t hash;
1012 u_long hmask;
1013 node_p node, node2;
1014 int i;
1015
1016 new = hashinit_flags((V_ng_ID_hmask + 1) * 2, M_NETGRAPH_NODE, &hmask,
1017 HASH_NOWAIT);
1018 if (new == NULL)
1019 return;
1020
1021 for (i = 0; i <= V_ng_ID_hmask; i++)
1022 LIST_FOREACH_SAFE(node, &V_ng_ID_hash[i], nd_idnodes, node2) {
1023#ifdef INVARIANTS
1024 LIST_REMOVE(node, nd_idnodes);
1025#endif
1026 hash = (node->nd_ID % (hmask + 1));
1027 LIST_INSERT_HEAD(&new[hash], node, nd_idnodes);
1028 }
1029
1030 hashdestroy(V_ng_ID_hash, M_NETGRAPH_NODE, V_ng_name_hmask);
1031 V_ng_ID_hash = new;
1032 V_ng_ID_hmask = hmask;
1033}
1034
1035/************************************************************************
1036 Hook routines

Callers 1

ng_make_node_commonFunction · 0.70

Calls 2

hashinit_flagsFunction · 0.50
hashdestroyFunction · 0.50

Tested by

no test coverage detected