Lines Matching refs:hfi

212 static hook_event_int_t *hook_event_find(hook_family_int_t *hfi, char *event);
213 static void hook_event_free(hook_event_int_t *hei, hook_family_int_t *hfi);
216 static void hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks);
231 static void hook_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei,
642 hook_family_int_t *hfi; in hook_stack_notify_register() local
679 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_register()
680 if (hfi->hfi_condemned || hfi->hfi_shutdown) in hook_stack_notify_register()
683 hfi->hfi_family.hf_name); in hook_stack_notify_register()
708 hook_family_int_t *hfi; in hook_stack_notify_unregister() local
751 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_unregister()
753 hfi->hfi_family.hf_name); in hook_stack_notify_unregister()
815 hook_run(hook_family_int_t *hfi, hook_event_token_t token, hook_data_t info) in hook_run() argument
832 CVW_ENTER_READ(&hfi->hfi_lock); in hook_run()
853 CVW_EXIT_READ(&hfi->hfi_lock); in hook_run()
884 hook_family_int_t *hfi, *new; in hook_family_add() local
904 hfi = hook_family_find(hf->hf_name, hks); in hook_family_add()
905 if (hfi != NULL) { in hook_family_add()
958 hook_family_remove(hook_family_int_t *hfi) in hook_family_remove() argument
963 ASSERT(hfi != NULL); in hook_family_remove()
964 hks = hfi->hfi_stack; in hook_family_remove()
966 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_remove()
967 notifydone = hfi->hfi_shutdown; in hook_family_remove()
968 hfi->hfi_shutdown = B_TRUE; in hook_family_remove()
969 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_remove()
986 if (!SLIST_EMPTY(&hfi->hfi_head) || !TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_family_remove()
987 hfi->hfi_condemned = B_TRUE; in hook_family_remove()
989 VERIFY(hook_wait_destroy(&hfi->hfi_waiter) == 0); in hook_family_remove()
994 hfi->hfi_condemned = B_FALSE; in hook_family_remove()
999 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_remove()
1008 if (!hfi->hfi_condemned) in hook_family_remove()
1009 hook_family_free(hfi, hks); in hook_family_remove()
1023 hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks) in hook_family_free() argument
1033 ASSERT(hfi != NULL); in hook_family_free()
1038 SLIST_REMOVE(&hks->hks_familylist, hfi, hook_family_int, in hook_family_free()
1045 if (hfi->hfi_family.hf_name != NULL) { in hook_family_free()
1046 kmem_free(hfi->hfi_family.hf_name, in hook_family_free()
1047 strlen(hfi->hfi_family.hf_name) + 1); in hook_family_free()
1051 kmem_free(hfi, sizeof (*hfi)); in hook_family_free()
1070 hook_family_shutdown(hook_family_int_t *hfi) in hook_family_shutdown() argument
1075 ASSERT(hfi != NULL); in hook_family_shutdown()
1076 hks = hfi->hfi_stack; in hook_family_shutdown()
1078 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_shutdown()
1079 notifydone = hfi->hfi_shutdown; in hook_family_shutdown()
1080 hfi->hfi_shutdown = B_TRUE; in hook_family_shutdown()
1081 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_shutdown()
1097 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_shutdown()
1149 hook_family_int_t *hfi = NULL; in hook_family_find() local
1153 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_family_find()
1154 if (strcmp(hfi->hfi_family.hf_name, family) == 0) in hook_family_find()
1157 return (hfi); in hook_family_find()
1179 hook_family_notify_register(hook_family_int_t *hfi, in hook_family_notify_register() argument
1187 ASSERT(hfi != NULL); in hook_family_notify_register()
1189 hks = hfi->hfi_stack; in hook_family_notify_register()
1193 if ((hfi->hfi_stack->hks_shutdown != 0) || in hook_family_notify_register()
1194 hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_family_notify_register()
1199 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_notify_register()
1200 canrun = (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_family_notify_register()
1202 error = hook_notify_register(&hfi->hfi_nhead, callback, arg); in hook_family_notify_register()
1203 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_notify_register()
1208 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_family_notify_register()
1210 hfi->hfi_family.hf_name, NULL, in hook_family_notify_register()
1216 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_family_notify_register()
1245 hook_family_notify_unregister(hook_family_int_t *hfi, in hook_family_notify_unregister() argument
1256 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_family_notify_unregister()
1258 (void) hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_family_notify_unregister()
1261 error = hook_notify_unregister(&hfi->hfi_nhead, callback, &arg); in hook_family_notify_unregister()
1263 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_family_notify_unregister()
1269 if ((error == 0) && hfi->hfi_condemned && in hook_family_notify_unregister()
1270 SLIST_EMPTY(&hfi->hfi_head) && TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_family_notify_unregister()
1277 canrun = (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_family_notify_unregister()
1281 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_family_notify_unregister()
1284 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_family_notify_unregister()
1286 hfi->hfi_family.hf_name, NULL, in hook_family_notify_unregister()
1290 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_family_notify_unregister()
1292 hook_family_free(hfi, hfi->hfi_stack); in hook_family_notify_unregister()
1310 hook_event_add(hook_family_int_t *hfi, hook_event_t *he) in hook_event_add() argument
1315 ASSERT(hfi != NULL); in hook_event_add()
1323 hks = hfi->hfi_stack; in hook_event_add()
1326 hks = hfi->hfi_stack; in hook_event_add()
1341 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_add()
1343 if (hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_event_add()
1344 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1351 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_ADD_WAIT_MASK, in hook_event_add()
1353 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1360 hook_event_init_kstats(hfi, new); in hook_event_add()
1364 SLIST_INSERT_HEAD(&hfi->hfi_head, new, hei_entry); in hook_event_add()
1366 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_add()
1368 hook_notify_run(&hfi->hfi_nhead, in hook_event_add()
1369 hfi->hfi_family.hf_name, NULL, he->he_name, HN_REGISTER); in hook_event_add()
1371 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_ADD_ACTIVE); in hook_event_add()
1389 hook_event_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei) in hook_event_init_kstats() argument
1398 hks = hfi->hfi_stack; in hook_event_init_kstats()
1399 hei->hei_kstatp = kstat_create_netstack(hfi->hfi_family.hf_name, 0, in hook_event_init_kstats()
1430 hook_event_remove(hook_family_int_t *hfi, hook_event_t *he) in hook_event_remove() argument
1436 ASSERT(hfi != NULL); in hook_event_remove()
1439 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_remove()
1446 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_event_remove()
1448 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1452 hei = hook_event_find(hfi, he->he_name); in hook_event_remove()
1454 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_remove()
1455 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1487 if (hfi->hfi_condemned && SLIST_EMPTY(&hfi->hfi_head) && in hook_event_remove()
1488 TAILQ_EMPTY(&hfi->hfi_nhead)) in hook_event_remove()
1492 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_remove()
1495 hook_notify_run(&hfi->hfi_nhead, in hook_event_remove()
1496 hfi->hfi_family.hf_name, NULL, he->he_name, HN_UNREGISTER); in hook_event_remove()
1498 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_remove()
1501 hook_event_free(hei, hfi); in hook_event_remove()
1503 hook_family_free(hfi, hfi->hfi_stack); in hook_event_remove()
1519 hook_event_shutdown(hook_family_int_t *hfi, hook_event_t *he) in hook_event_shutdown() argument
1524 ASSERT(hfi != NULL); in hook_event_shutdown()
1527 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1534 if (hook_wait_setflag(&hfi->hfi_waiter, FWF_DEL_WAIT_MASK, in hook_event_shutdown()
1536 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1540 hei = hook_event_find(hfi, he->he_name); in hook_event_shutdown()
1542 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_shutdown()
1543 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1552 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_shutdown()
1555 hook_notify_run(&hfi->hfi_nhead, in hook_event_shutdown()
1556 hfi->hfi_family.hf_name, NULL, he->he_name, HN_UNREGISTER); in hook_event_shutdown()
1558 hook_wait_unsetflag(&hfi->hfi_waiter, FWF_DEL_ACTIVE); in hook_event_shutdown()
1571 hook_event_free(hook_event_int_t *hei, hook_family_int_t *hfi) in hook_event_free() argument
1577 if (hfi != NULL) { in hook_event_free()
1578 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_event_free()
1582 SLIST_REMOVE(&hfi->hfi_head, hei, hook_event_int, hei_entry); in hook_event_free()
1583 if (hfi->hfi_condemned && SLIST_EMPTY(&hfi->hfi_head) && in hook_event_free()
1584 TAILQ_EMPTY(&hfi->hfi_nhead)) { in hook_event_free()
1589 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_event_free()
1593 ASSERT(hfi != NULL); in hook_event_free()
1596 hfi->hfi_stack->hks_netstackid); in hook_event_free()
1604 hook_family_free(hfi, hfi->hfi_stack); in hook_event_free()
1618 hook_family_int_t *hfi; in hook_event_checkdup() local
1624 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_event_checkdup()
1625 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_event_checkdup()
1672 hook_event_find(hook_family_int_t *hfi, char *event) in hook_event_find() argument
1676 ASSERT(hfi != NULL); in hook_event_find()
1679 SLIST_FOREACH(hei, &hfi->hfi_head, hei_entry) { in hook_event_find()
1700 hook_event_notify_register(hook_family_int_t *hfi, char *event, in hook_event_notify_register() argument
1710 hks = hfi->hfi_stack; in hook_event_notify_register()
1717 CVW_ENTER_READ(&hfi->hfi_lock); in hook_event_notify_register()
1719 if (hfi->hfi_condemned || hfi->hfi_shutdown) { in hook_event_notify_register()
1720 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1725 hei = hook_event_find(hfi, event); in hook_event_notify_register()
1727 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1733 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1744 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_register()
1750 hfi->hfi_family.hf_name, hei->hei_event->he_name, in hook_event_notify_register()
1772 hook_event_notify_unregister(hook_family_int_t *hfi, char *event, in hook_event_notify_unregister() argument
1784 CVW_ENTER_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1786 hei = hook_event_find(hfi, event); in hook_event_notify_unregister()
1788 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1822 CVW_EXIT_READ(&hfi->hfi_lock); in hook_event_notify_unregister()
1827 hfi->hfi_family.hf_name, hei->hei_event->he_name, in hook_event_notify_unregister()
1840 hook_event_free(hei, hfi); in hook_event_notify_unregister()
1857 hook_event_notify_run(hook_event_int_t *hei, hook_family_int_t *hfi, in hook_event_notify_run() argument
1861 hook_notify_run(&hei->hei_nhead, hfi->hfi_family.hf_name, in hook_event_notify_run()
1875 hook_register(hook_family_int_t *hfi, char *event, hook_t *h) in hook_register() argument
1881 ASSERT(hfi != NULL); in hook_register()
1885 if (hfi->hfi_stack->hks_shutdown) in hook_register()
1898 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_register()
1900 hei = hook_event_find(hfi, event); in hook_register()
1902 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1903 hook_int_free(new, hfi->hfi_stack->hks_netstackid); in hook_register()
1929 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1930 hook_int_free(new, hfi->hfi_stack->hks_netstackid); in hook_register()
1940 hook_init_kstats(hfi, hei, new); in hook_register()
1944 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_register()
1952 hook_event_notify_run(hei, hfi, event, h->h_name, HN_REGISTER); in hook_register()
2167 hook_unregister(hook_family_int_t *hfi, char *event, hook_t *h) in hook_unregister() argument
2173 ASSERT(hfi != NULL); in hook_unregister()
2176 CVW_ENTER_WRITE(&hfi->hfi_lock); in hook_unregister()
2178 hei = hook_event_find(hfi, event); in hook_unregister()
2180 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2190 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2197 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2218 CVW_EXIT_WRITE(&hfi->hfi_lock); in hook_unregister()
2224 hook_event_notify_run(hei, hfi, event, h->h_name, HN_UNREGISTER); in hook_unregister()
2227 hook_int_free(hi, hfi->hfi_stack->hks_netstackid); in hook_unregister()
2230 hook_event_free(hei, hfi); in hook_unregister()
2343 hook_init_kstats(hook_family_int_t *hfi, hook_event_int_t *hei, hook_int_t *hi) in hook_init_kstats() argument
2358 kslen = strlen(hfi->hfi_family.hf_name) + in hook_init_kstats()
2363 hfi->hfi_family.hf_name, hei->hei_event->he_name); in hook_init_kstats()
2365 hks = hfi->hfi_stack; in hook_init_kstats()