| 781 | } |
| 782 | |
| 783 | static void |
| 784 | ngs_rehash(node_p node) |
| 785 | { |
| 786 | struct ngsock *priv = NG_NODE_PRIVATE(node); |
| 787 | struct ngshash *new; |
| 788 | struct hookpriv *hp; |
| 789 | hook_p hook; |
| 790 | uint32_t h; |
| 791 | u_long hmask; |
| 792 | |
| 793 | new = hashinit_flags((priv->hmask + 1) * 2, M_NETGRAPH_SOCK, &hmask, |
| 794 | HASH_NOWAIT); |
| 795 | if (new == NULL) |
| 796 | return; |
| 797 | |
| 798 | LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { |
| 799 | hp = NG_HOOK_PRIVATE(hook); |
| 800 | #ifdef INVARIANTS |
| 801 | LIST_REMOVE(hp, next); |
| 802 | #endif |
| 803 | h = hash32_str(NG_HOOK_NAME(hook), HASHINIT) & hmask; |
| 804 | LIST_INSERT_HEAD(&new[h], hp, next); |
| 805 | } |
| 806 | |
| 807 | hashdestroy(priv->hash, M_NETGRAPH_SOCK, priv->hmask); |
| 808 | priv->hash = new; |
| 809 | priv->hmask = hmask; |
| 810 | } |
| 811 | |
| 812 | /* |
| 813 | * We allow any hook to be connected to the node. |
no test coverage detected