Lines Matching refs:hfi
211 static hook_event_int_t *hook_event_find(hook_family_int_t *hfi, char *event);
212 static void hook_event_free(hook_event_int_t *hei, hook_family_int_t *hfi);
215 static void hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks);
230 static void hook_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei,
641 hook_family_int_t *hfi; in hook_stack_notify_register() local
678 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_register()
679 if (hfi->hfi_condemned || hfi->hfi_shutdown) in hook_stack_notify_register()
682 hfi->hfi_family.hf_name); in hook_stack_notify_register()
707 hook_family_int_t *hfi; in hook_stack_notify_unregister() local
738 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_unregister()
740 hfi->hfi_family.hf_name); in hook_stack_notify_unregister()
799 hook_run(hook_family_int_t *hfi, hook_event_token_t token, hook_data_t info) in hook_run() argument
816 CVW_ENTER_READ(&hfi->hfi_lock); in hook_run()
837 CVW_EXIT_READ(&hfi->hfi_lock); in hook_run()
868 hook_family_int_t *hfi, *new; in hook_family_add() local
888 hfi = hook_family_find(hf->hf_name, hks); in hook_family_add()
889 if (hfi != NULL) { in hook_family_add()
942 hook_family_remove(hook_family_int_t *hfi) in hook_family_remove() argument
947 ASSERT(hfi != NULL); in hook_family_remove()
948 hks = hfi->hfi_stack; in hook_family_remove()
950 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_remove()
951 notifydone = hfi->hfi_shutdown; in hook_family_remove()
952 hfi->hfi_shutdown = B_TRUE; in hook_family_remove()
953 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_remove()
970 if (!SLIST_EMPTY(&hfi->hfi_head) || !TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_family_remove()
971 hfi->hfi_condemned = B_TRUE; in hook_family_remove()
973 VERIFY(hook_wait_destroy(&hfi->hfi_waiter) == 0); in hook_family_remove()
978 hfi->hfi_condemned = B_FALSE; in hook_family_remove()
983 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_remove()
992 if (!hfi->hfi_condemned) in hook_family_remove()
993 hook_family_free(hfi, hks); in hook_family_remove()
1007 hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks) in hook_family_free() argument
1017 ASSERT(hfi != NULL); in hook_family_free()
1022 SLIST_REMOVE(&hks->hks_familylist, hfi, hook_family_int, in hook_family_free()
1029 if (hfi->hfi_family.hf_name != NULL) { in hook_family_free()
1030 kmem_free(hfi->hfi_family.hf_name, in hook_family_free()
1031 strlen(hfi->hfi_family.hf_name) + 1); in hook_family_free()
1035 kmem_free(hfi, sizeof (*hfi)); in hook_family_free()
1054 hook_family_shutdown(hook_family_int_t *hfi) in hook_family_shutdown() argument
1059 ASSERT(hfi != NULL); in hook_family_shutdown()
1060 hks = hfi->hfi_stack; in hook_family_shutdown()
1062 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_shutdown()
1063 notifydone = hfi->hfi_shutdown; in hook_family_shutdown()
1064 hfi->hfi_shutdown = B_TRUE; in hook_family_shutdown()
1065 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_shutdown()
1081 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_shutdown()
1133 hook_family_int_t *hfi = NULL; in hook_family_find() local
1137 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_family_find()
1138 if (strcmp(hfi->hfi_family.hf_name, family) == 0) in hook_family_find()
1141 return (hfi); in hook_family_find()
1163 hook_family_notify_register(hook_family_int_t *hfi, in hook_family_notify_register() argument
1171 ASSERT(hfi != NULL); in hook_family_notify_register()
1173 hks = hfi->hfi_stack; in hook_family_notify_register()
1177 if ((hfi->hfi_stack->hks_shutdown != 0) || in hook_family_notify_register()
1178 hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_family_notify_register()
1183 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_notify_register()
1184 canrun = (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_family_notify_register()
1186 error = hook_notify_register(&hfi->hfi_nhead, callback, arg); in hook_family_notify_register()
1187 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_notify_register()
1192 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_family_notify_register()
1194 hfi->hfi_family.hf_name, NULL, in hook_family_notify_register()
1200 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_family_notify_register()
1229 hook_family_notify_unregister(hook_family_int_t *hfi, in hook_family_notify_unregister() argument
1240 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_notify_unregister()
1242 (void) hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_family_notify_unregister()
1245 error = hook_notify_unregister(&hfi->hfi_nhead, callback, &arg); in hook_family_notify_unregister()
1247 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_family_notify_unregister()
1253 if ((error == 0) && hfi->hfi_condemned && in hook_family_notify_unregister()
1254 SLIST_EMPTY(&hfi->hfi_head) && TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_family_notify_unregister()
1261 canrun = (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_family_notify_unregister()
1265 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_notify_unregister()
1268 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_family_notify_unregister()
1270 hfi->hfi_family.hf_name, NULL, in hook_family_notify_unregister()
1274 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_family_notify_unregister()
1276 hook_family_free(hfi, hfi->hfi_stack); in hook_family_notify_unregister()
1294 hook_event_add(hook_family_int_t *hfi, hook_event_t *he) in hook_event_add() argument
1299 ASSERT(hfi != NULL); in hook_event_add()
1307 hks = hfi->hfi_stack; in hook_event_add()
1310 hks = hfi->hfi_stack; in hook_event_add()
1325 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_add()
1327 if (hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_event_add()
1328 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1335 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_event_add()
1337 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1344 hook_event_init_kstats(hfi, new); in hook_event_add()
1348 SLIST_INSERT_HEAD(&hfi->hfi_head, new, hei_entry); in hook_event_add()
1350 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1352 hook_notify_run(&hfi->hfi_nhead, in hook_event_add()
1353 hfi->hfi_family.hf_name, NULL, he->he_name, HN_REGISTER); in hook_event_add()
1355 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_event_add()
1373 hook_event_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei) in hook_event_init_kstats() argument
1382 hks = hfi->hfi_stack; in hook_event_init_kstats()
1383 hei->hei_kstatp = kstat_create_netstack(hfi->hfi_family.hf_name, 0, in hook_event_init_kstats()
1414 hook_event_remove(hook_family_int_t *hfi, hook_event_t *he) in hook_event_remove() argument
1420 ASSERT(hfi != NULL); in hook_event_remove()
1423 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_remove()
1430 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_event_remove()
1432 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1436 hei = hook_event_find(hfi, he->he_name); in hook_event_remove()
1438 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_remove()
1439 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1471 if (hfi->hfi_condemned && SLIST_EMPTY(&hfi->hfi_head) && in hook_event_remove()
1472 TAILQ_EMPTY(&hfi->hfi_nhead)) in hook_event_remove()
1476 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1479 hook_notify_run(&hfi->hfi_nhead, in hook_event_remove()
1480 hfi->hfi_family.hf_name, NULL, he->he_name, HN_UNREGISTER); in hook_event_remove()
1482 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_remove()
1485 hook_event_free(hei, hfi); in hook_event_remove()
1487 hook_family_free(hfi, hfi->hfi_stack); in hook_event_remove()
1503 hook_event_shutdown(hook_family_int_t *hfi, hook_event_t *he) in hook_event_shutdown() argument
1508 ASSERT(hfi != NULL); in hook_event_shutdown()
1511 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1518 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_event_shutdown()
1520 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1524 hei = hook_event_find(hfi, he->he_name); in hook_event_shutdown()
1526 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_shutdown()
1527 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1536 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1539 hook_notify_run(&hfi->hfi_nhead, in hook_event_shutdown()
1540 hfi->hfi_family.hf_name, NULL, he->he_name, HN_UNREGISTER); in hook_event_shutdown()
1542 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_shutdown()
1555 hook_event_free(hook_event_int_t *hei, hook_family_int_t *hfi) in hook_event_free() argument
1561 if (hfi != NULL) { in hook_event_free()
1562 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_free()
1566 SLIST_REMOVE(&hfi->hfi_head, hei, hook_event_int, hei_entry); in hook_event_free()
1567 if (hfi->hfi_condemned && SLIST_EMPTY(&hfi->hfi_head) && in hook_event_free()
1568 TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_event_free()
1573 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_free()
1577 ASSERT(hfi != NULL); in hook_event_free()
1580 hfi->hfi_stack->hks_netstackid); in hook_event_free()
1588 hook_family_free(hfi, hfi->hfi_stack); in hook_event_free()
1602 hook_family_int_t *hfi; in hook_event_checkdup() local
1608 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_event_checkdup()
1609 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_event_checkdup()
1656 hook_event_find(hook_family_int_t *hfi, char *event) in hook_event_find() argument
1660 ASSERT(hfi != NULL); in hook_event_find()
1663 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_event_find()
1684 hook_event_notify_register(hook_family_int_t *hfi, char *event, in hook_event_notify_register() argument
1694 hks = hfi->hfi_stack; in hook_event_notify_register()
1701 CVW_ENTER_READ(&hfi->hfi_lock); in hook_event_notify_register()
1703 if (hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_event_notify_register()
1704 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1709 hei = hook_event_find(hfi, event); in hook_event_notify_register()
1711 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1717 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1728 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1734 hfi->hfi_family.hf_name, hei->hei_event->he_name, in hook_event_notify_register()
1756 hook_event_notify_unregister(hook_family_int_t *hfi, char *event, in hook_event_notify_unregister() argument
1768 CVW_ENTER_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1770 hei = hook_event_find(hfi, event); in hook_event_notify_unregister()
1772 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1806 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1811 hfi->hfi_family.hf_name, hei->hei_event->he_name, in hook_event_notify_unregister()
1824 hook_event_free(hei, hfi); in hook_event_notify_unregister()
1841 hook_event_notify_run(hook_event_int_t *hei, hook_family_int_t *hfi, in hook_event_notify_run() argument
1845 hook_notify_run(&hei->hei_nhead, hfi->hfi_family.hf_name, in hook_event_notify_run()
1859 hook_register(hook_family_int_t *hfi, char *event, hook_t *h) in hook_register() argument
1865 ASSERT(hfi != NULL); in hook_register()
1869 if (hfi->hfi_stack->hks_shutdown) in hook_register()
1882 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_register()
1884 hei = hook_event_find(hfi, event); in hook_register()
1886 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1887 hook_int_free(new, hfi->hfi_stack->hks_netstackid); in hook_register()
1913 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1914 hook_int_free(new, hfi->hfi_stack->hks_netstackid); in hook_register()
1924 hook_init_kstats(hfi, hei, new); in hook_register()
1928 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1936 hook_event_notify_run(hei, hfi, event, h->h_name, HN_REGISTER); in hook_register()
2151 hook_unregister(hook_family_int_t *hfi, char *event, hook_t *h) in hook_unregister() argument
2157 ASSERT(hfi != NULL); in hook_unregister()
2160 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_unregister()
2162 hei = hook_event_find(hfi, event); in hook_unregister()
2164 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2174 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2181 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2202 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2208 hook_event_notify_run(hei, hfi, event, h->h_name, HN_UNREGISTER); in hook_unregister()
2211 hook_int_free(hi, hfi->hfi_stack->hks_netstackid); in hook_unregister()
2214 hook_event_free(hei, hfi); in hook_unregister()
2327 hook_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei, hook_int_t *hi) in hook_init_kstats() argument
2342 kslen = strlen(hfi->hfi_family.hf_name) + in hook_init_kstats()
2347 hfi->hfi_family.hf_name, hei->hei_event->he_name); in hook_init_kstats()
2349 hks = hfi->hfi_stack; in hook_init_kstats()