Lines Matching refs:hks
210 hook_stack_t *hks);
215 static hook_family_int_t *hook_family_find(char *family, hook_stack_t *hks);
216 static void hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks);
239 static void hook_stack_notify_run(hook_stack_t *hks, char *name,
241 static void hook_stack_remove(hook_stack_t *hks);
492 hook_stack_t *hks; in hook_stack_init() local
498 hks = (hook_stack_t *)kmem_zalloc(sizeof (*hks), KM_SLEEP); in hook_stack_init()
499 hks->hks_netstack = ns; in hook_stack_init()
500 hks->hks_netstackid = stackid; in hook_stack_init()
502 CVW_INIT(&hks->hks_lock); in hook_stack_init()
503 TAILQ_INIT(&hks->hks_nhead); in hook_stack_init()
504 SLIST_INIT(&hks->hks_familylist); in hook_stack_init()
506 hook_wait_init(&hks->hks_waiter, &hks->hks_lock); in hook_stack_init()
509 SLIST_INSERT_HEAD(&hook_stacks, hks, hks_entry); in hook_stack_init()
512 return (hks); in hook_stack_init()
535 hook_stack_t *hks = (hook_stack_t *)arg; in hook_stack_shutdown() local
542 hks->hks_shutdown = 1; in hook_stack_shutdown()
563 hook_stack_t *hks = (hook_stack_t *)arg; in hook_stack_fini() local
566 hks->hks_shutdown = 2; in hook_stack_fini()
567 hook_stack_remove(hks); in hook_stack_fini()
582 hook_stack_remove(hook_stack_t *hks) in hook_stack_remove() argument
590 if (!SLIST_EMPTY(&hks->hks_familylist) || in hook_stack_remove()
591 !TAILQ_EMPTY(&hks->hks_nhead)) in hook_stack_remove()
594 SLIST_REMOVE(&hook_stacks, hks, hook_stack, hks_entry); in hook_stack_remove()
596 VERIFY(hook_wait_destroy(&hks->hks_waiter) == 0); in hook_stack_remove()
597 CVW_DESTROY(&hks->hks_lock); in hook_stack_remove()
598 kmem_free(hks, sizeof (*hks)); in hook_stack_remove()
613 hook_stack_t *hks; in hook_stack_get() local
615 SLIST_FOREACH(hks, &hook_stacks, hks_entry) { in hook_stack_get()
616 if (hks->hks_netstackid == stackid) in hook_stack_get()
620 return (hks); in hook_stack_get()
643 hook_stack_t *hks; in hook_stack_notify_register() local
652 hks = hook_stack_get(stackid); in hook_stack_notify_register()
653 if (hks != NULL) { in hook_stack_notify_register()
654 if (hks->hks_shutdown != 0) { in hook_stack_notify_register()
657 CVW_ENTER_WRITE(&hks->hks_lock); in hook_stack_notify_register()
658 canrun = (hook_wait_setflag(&hks->hks_waiter, in hook_stack_notify_register()
661 error = hook_notify_register(&hks->hks_nhead, in hook_stack_notify_register()
663 CVW_EXIT_WRITE(&hks->hks_lock); in hook_stack_notify_register()
677 hks->hks_netstackid); in hook_stack_notify_register()
679 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_register()
688 hook_wait_unsetflag(&hks->hks_waiter, FWF_ADD_ACTIVE); in hook_stack_notify_register()
709 hook_stack_t *hks; in hook_stack_notify_unregister() local
715 hks = hook_stack_get(stackid); in hook_stack_notify_unregister()
716 if (hks == NULL) { in hook_stack_notify_unregister()
721 CVW_ENTER_WRITE(&hks->hks_lock); in hook_stack_notify_unregister()
730 if (hook_wait_setflag(&hks->hks_waiter, FWF_DEL_WAIT_MASK, in hook_stack_notify_unregister()
732 VERIFY(TAILQ_EMPTY(&hks->hks_nhead)); in hook_stack_notify_unregister()
733 CVW_EXIT_WRITE(&hks->hks_lock); in hook_stack_notify_unregister()
738 error = hook_notify_unregister(&hks->hks_nhead, callback, &arg); in hook_stack_notify_unregister()
739 CVW_EXIT_WRITE(&hks->hks_lock); in hook_stack_notify_unregister()
749 hks->hks_netstackid); in hook_stack_notify_unregister()
751 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_unregister()
764 hook_wait_unsetflag(&hks->hks_waiter, FWF_DEL_ACTIVE); in hook_stack_notify_unregister()
765 if (hks->hks_shutdown == 2) in hook_stack_notify_unregister()
766 hook_stack_remove(hks); in hook_stack_notify_unregister()
789 hook_stack_notify_run(hook_stack_t *hks, char *name, in hook_stack_notify_run() argument
794 ASSERT(hks != NULL); in hook_stack_notify_run()
797 (void) snprintf(buffer, sizeof (buffer), "%u", hks->hks_netstackid); in hook_stack_notify_run()
799 hook_notify_run(&hks->hks_nhead, buffer, NULL, name, cmd); in hook_stack_notify_run()
882 hook_family_add(hook_family_t *hf, hook_stack_t *hks, void **store) in hook_family_add() argument
894 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_add()
896 if (hks->hks_shutdown != 0) { in hook_family_add()
897 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
904 hfi = hook_family_find(hf->hf_name, hks); in hook_family_add()
906 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
917 if (hook_wait_setflag(&hks->hks_waiter, FWF_ADD_WAIT_MASK, in hook_family_add()
919 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
931 new->hfi_stack = hks; in hook_family_add()
936 SLIST_INSERT_HEAD(&hks->hks_familylist, new, hfi_entry); in hook_family_add()
938 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
941 hook_stack_notify_run(hks, hf->hf_name, HN_REGISTER); in hook_family_add()
943 hook_wait_unsetflag(&hks->hks_waiter, FWF_ADD_ACTIVE); in hook_family_add()
960 hook_stack_t *hks; in hook_family_remove() local
964 hks = hfi->hfi_stack; in hook_family_remove()
971 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_remove()
973 if (hook_wait_setflag(&hks->hks_waiter, FWF_DEL_WAIT_MASK, in hook_family_remove()
978 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_remove()
996 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_remove()
999 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_remove()
1002 hook_wait_unsetflag(&hks->hks_waiter, FWF_DEL_ACTIVE); 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
1035 if (hks != NULL) { in hook_family_free()
1036 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_free()
1038 SLIST_REMOVE(&hks->hks_familylist, hfi, hook_family_int, in hook_family_free()
1041 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_free()
1053 if (hks != NULL && hks->hks_shutdown == 2) in hook_family_free()
1054 hook_stack_remove(hks); in hook_family_free()
1072 hook_stack_t *hks; in hook_family_shutdown() local
1076 hks = hfi->hfi_stack; in hook_family_shutdown()
1083 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_shutdown()
1085 if (hook_wait_setflag(&hks->hks_waiter, FWF_DEL_WAIT_MASK, in hook_family_shutdown()
1090 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_shutdown()
1094 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_shutdown()
1097 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_shutdown()
1100 hook_wait_unsetflag(&hks->hks_waiter, FWF_DEL_ACTIVE); in hook_family_shutdown()
1147 hook_family_find(char *family, hook_stack_t *hks) in hook_family_find() argument
1153 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_family_find()
1183 hook_stack_t *hks; in hook_family_notify_register() local
1189 hks = hfi->hfi_stack; in hook_family_notify_register()
1191 CVW_ENTER_READ(&hks->hks_lock); in hook_family_notify_register()
1195 CVW_EXIT_READ(&hks->hks_lock); in hook_family_notify_register()
1205 CVW_EXIT_READ(&hks->hks_lock); in hook_family_notify_register()
1313 hook_stack_t *hks; in hook_event_add() local
1323 hks = hfi->hfi_stack; in hook_event_add()
1324 CVW_ENTER_READ(&hks->hks_lock); in hook_event_add()
1326 hks = hfi->hfi_stack; in hook_event_add()
1327 if (hks->hks_shutdown != 0) { in hook_event_add()
1328 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1334 hei = hook_event_checkdup(he, hks); in hook_event_add()
1336 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1345 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1349 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1396 hook_stack_t *hks; in hook_event_init_kstats() local
1398 hks = hfi->hfi_stack; in hook_event_init_kstats()
1402 KSTAT_FLAG_VIRTUAL, hks->hks_netstackid); in hook_event_init_kstats()
1409 (void *)(uintptr_t)hks->hks_netstackid; in hook_event_init_kstats()
1616 hook_event_checkdup(hook_event_t *he, hook_stack_t *hks) in hook_event_checkdup() argument
1623 CVW_ENTER_READ(&hks->hks_lock); in hook_event_checkdup()
1624 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_event_checkdup()
1627 CVW_EXIT_READ(&hks->hks_lock); in hook_event_checkdup()
1632 CVW_EXIT_READ(&hks->hks_lock); in hook_event_checkdup()
1704 hook_stack_t *hks; in hook_event_notify_register() local
1710 hks = hfi->hfi_stack; in hook_event_notify_register()
1711 CVW_ENTER_READ(&hks->hks_lock); in hook_event_notify_register()
1712 if (hks->hks_shutdown != 0) { in hook_event_notify_register()
1713 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1721 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1728 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1734 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1745 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
2353 hook_stack_t *hks; in hook_init_kstats() local
2365 hks = hfi->hfi_stack; in hook_init_kstats()
2369 KSTAT_FLAG_VIRTUAL, hks->hks_netstackid); in hook_init_kstats()
2394 (void *)(uintptr_t)hks->hks_netstackid; in hook_init_kstats()