Lines Matching refs:hks
209 hook_stack_t *hks);
214 static hook_family_int_t *hook_family_find(char *family, hook_stack_t *hks);
215 static void hook_family_free(hook_family_int_t *hfi, hook_stack_t *hks);
238 static void hook_stack_notify_run(hook_stack_t *hks, char *name,
240 static void hook_stack_remove(hook_stack_t *hks);
491 hook_stack_t *hks; in hook_stack_init() local
497 hks = (hook_stack_t *)kmem_zalloc(sizeof (*hks), KM_SLEEP); in hook_stack_init()
498 hks->hks_netstack = ns; in hook_stack_init()
499 hks->hks_netstackid = stackid; in hook_stack_init()
501 CVW_INIT(&hks->hks_lock); in hook_stack_init()
502 TAILQ_INIT(&hks->hks_nhead); in hook_stack_init()
503 SLIST_INIT(&hks->hks_familylist); in hook_stack_init()
505 hook_wait_init(&hks->hks_waiter, &hks->hks_lock); in hook_stack_init()
508 SLIST_INSERT_HEAD(&hook_stacks, hks, hks_entry); in hook_stack_init()
511 return (hks); in hook_stack_init()
534 hook_stack_t *hks = (hook_stack_t *)arg; in hook_stack_shutdown() local
541 hks->hks_shutdown = 1; in hook_stack_shutdown()
562 hook_stack_t *hks = (hook_stack_t *)arg; in hook_stack_fini() local
565 hks->hks_shutdown = 2; in hook_stack_fini()
566 hook_stack_remove(hks); in hook_stack_fini()
581 hook_stack_remove(hook_stack_t *hks) in hook_stack_remove() argument
589 if (!SLIST_EMPTY(&hks->hks_familylist) || in hook_stack_remove()
590 !TAILQ_EMPTY(&hks->hks_nhead)) in hook_stack_remove()
593 SLIST_REMOVE(&hook_stacks, hks, hook_stack, hks_entry); in hook_stack_remove()
595 VERIFY(hook_wait_destroy(&hks->hks_waiter) == 0); in hook_stack_remove()
596 CVW_DESTROY(&hks->hks_lock); in hook_stack_remove()
597 kmem_free(hks, sizeof (*hks)); in hook_stack_remove()
612 hook_stack_t *hks; in hook_stack_get() local
614 SLIST_FOREACH(hks, &hook_stacks, hks_entry) { in hook_stack_get()
615 if (hks->hks_netstackid == stackid) in hook_stack_get()
619 return (hks); in hook_stack_get()
642 hook_stack_t *hks; in hook_stack_notify_register() local
651 hks = hook_stack_get(stackid); in hook_stack_notify_register()
652 if (hks != NULL) { in hook_stack_notify_register()
653 if (hks->hks_shutdown != 0) { in hook_stack_notify_register()
656 CVW_ENTER_WRITE(&hks->hks_lock); in hook_stack_notify_register()
657 canrun = (hook_wait_setflag(&hks->hks_waiter, in hook_stack_notify_register()
660 error = hook_notify_register(&hks->hks_nhead, in hook_stack_notify_register()
662 CVW_EXIT_WRITE(&hks->hks_lock); in hook_stack_notify_register()
676 hks->hks_netstackid); in hook_stack_notify_register()
678 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_register()
687 hook_wait_unsetflag(&hks->hks_waiter, FWF_ADD_ACTIVE); in hook_stack_notify_register()
708 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()
717 CVW_ENTER_WRITE(&hks->hks_lock); in hook_stack_notify_unregister()
718 canrun = (hook_wait_setflag(&hks->hks_waiter, FWF_ADD_WAIT_MASK, in hook_stack_notify_unregister()
721 error = hook_notify_unregister(&hks->hks_nhead, callback, &arg); in hook_stack_notify_unregister()
722 CVW_EXIT_WRITE(&hks->hks_lock); in hook_stack_notify_unregister()
736 hks->hks_netstackid); in hook_stack_notify_unregister()
738 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_stack_notify_unregister()
743 hook_wait_unsetflag(&hks->hks_waiter, FWF_ADD_ACTIVE); in hook_stack_notify_unregister()
747 hks = hook_stack_get(stackid); in hook_stack_notify_unregister()
748 if ((error == 0) && (hks->hks_shutdown == 2)) in hook_stack_notify_unregister()
749 hook_stack_remove(hks); in hook_stack_notify_unregister()
773 hook_stack_notify_run(hook_stack_t *hks, char *name, in hook_stack_notify_run() argument
778 ASSERT(hks != NULL); in hook_stack_notify_run()
781 (void) snprintf(buffer, sizeof (buffer), "%u", hks->hks_netstackid); in hook_stack_notify_run()
783 hook_notify_run(&hks->hks_nhead, buffer, NULL, name, cmd); in hook_stack_notify_run()
866 hook_family_add(hook_family_t *hf, hook_stack_t *hks, void **store) in hook_family_add() argument
878 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_add()
880 if (hks->hks_shutdown != 0) { in hook_family_add()
881 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
888 hfi = hook_family_find(hf->hf_name, hks); in hook_family_add()
890 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
901 if (hook_wait_setflag(&hks->hks_waiter, FWF_ADD_WAIT_MASK, in hook_family_add()
903 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
915 new->hfi_stack = hks; in hook_family_add()
920 SLIST_INSERT_HEAD(&hks->hks_familylist, new, hfi_entry); in hook_family_add()
922 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_add()
925 hook_stack_notify_run(hks, hf->hf_name, HN_REGISTER); in hook_family_add()
927 hook_wait_unsetflag(&hks->hks_waiter, FWF_ADD_ACTIVE); in hook_family_add()
944 hook_stack_t *hks; in hook_family_remove() local
948 hks = hfi->hfi_stack; in hook_family_remove()
955 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_remove()
957 if (hook_wait_setflag(&hks->hks_waiter, FWF_DEL_WAIT_MASK, in hook_family_remove()
962 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_remove()
980 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_remove()
983 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_remove()
986 hook_wait_unsetflag(&hks->hks_waiter, FWF_DEL_ACTIVE); 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
1019 if (hks != NULL) { in hook_family_free()
1020 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_free()
1022 SLIST_REMOVE(&hks->hks_familylist, hfi, hook_family_int, in hook_family_free()
1025 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_free()
1037 if (hks->hks_shutdown == 2) in hook_family_free()
1038 hook_stack_remove(hks); in hook_family_free()
1056 hook_stack_t *hks; in hook_family_shutdown() local
1060 hks = hfi->hfi_stack; in hook_family_shutdown()
1067 CVW_ENTER_WRITE(&hks->hks_lock); in hook_family_shutdown()
1069 if (hook_wait_setflag(&hks->hks_waiter, FWF_DEL_WAIT_MASK, in hook_family_shutdown()
1074 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_shutdown()
1078 CVW_EXIT_WRITE(&hks->hks_lock); in hook_family_shutdown()
1081 hook_stack_notify_run(hks, hfi->hfi_family.hf_name, in hook_family_shutdown()
1084 hook_wait_unsetflag(&hks->hks_waiter, FWF_DEL_ACTIVE); in hook_family_shutdown()
1131 hook_family_find(char *family, hook_stack_t *hks) in hook_family_find() argument
1137 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_family_find()
1167 hook_stack_t *hks; in hook_family_notify_register() local
1173 hks = hfi->hfi_stack; in hook_family_notify_register()
1175 CVW_ENTER_READ(&hks->hks_lock); in hook_family_notify_register()
1179 CVW_EXIT_READ(&hks->hks_lock); in hook_family_notify_register()
1189 CVW_EXIT_READ(&hks->hks_lock); in hook_family_notify_register()
1297 hook_stack_t *hks; in hook_event_add() local
1307 hks = hfi->hfi_stack; in hook_event_add()
1308 CVW_ENTER_READ(&hks->hks_lock); in hook_event_add()
1310 hks = hfi->hfi_stack; in hook_event_add()
1311 if (hks->hks_shutdown != 0) { in hook_event_add()
1312 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1318 hei = hook_event_checkdup(he, hks); in hook_event_add()
1320 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1329 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1333 CVW_EXIT_READ(&hks->hks_lock); in hook_event_add()
1380 hook_stack_t *hks; in hook_event_init_kstats() local
1382 hks = hfi->hfi_stack; in hook_event_init_kstats()
1386 KSTAT_FLAG_VIRTUAL, hks->hks_netstackid); in hook_event_init_kstats()
1393 (void *)(uintptr_t)hks->hks_netstackid; in hook_event_init_kstats()
1600 hook_event_checkdup(hook_event_t *he, hook_stack_t *hks) in hook_event_checkdup() argument
1607 CVW_ENTER_READ(&hks->hks_lock); in hook_event_checkdup()
1608 SLIST_FOREACH(hfi, &hks->hks_familylist, hfi_entry) { in hook_event_checkdup()
1611 CVW_EXIT_READ(&hks->hks_lock); in hook_event_checkdup()
1616 CVW_EXIT_READ(&hks->hks_lock); in hook_event_checkdup()
1688 hook_stack_t *hks; in hook_event_notify_register() local
1694 hks = hfi->hfi_stack; in hook_event_notify_register()
1695 CVW_ENTER_READ(&hks->hks_lock); in hook_event_notify_register()
1696 if (hks->hks_shutdown != 0) { in hook_event_notify_register()
1697 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1705 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1712 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1718 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
1729 CVW_EXIT_READ(&hks->hks_lock); in hook_event_notify_register()
2337 hook_stack_t *hks; in hook_init_kstats() local
2349 hks = hfi->hfi_stack; in hook_init_kstats()
2353 KSTAT_FLAG_VIRTUAL, hks->hks_netstackid); in hook_init_kstats()
2378 (void *)(uintptr_t)hks->hks_netstackid; in hook_init_kstats()