Lines Matching defs:hhh

75 static void hhook_head_destroy(struct hhook_head *hhh);
76 void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
82 #define HHH_LOCK_INIT(hhh) rm_init(&(hhh)->hhh_lock, "hhook_head rm lock")
83 #define HHH_LOCK_DESTROY(hhh) rm_destroy(&(hhh)->hhh_lock)
84 #define HHH_WLOCK(hhh) rm_wlock(&(hhh)->hhh_lock)
85 #define HHH_WUNLOCK(hhh) rm_wunlock(&(hhh)->hhh_lock)
86 #define HHH_RLOCK(hhh, rmpt) rm_rlock(&(hhh)->hhh_lock, (rmpt))
87 #define HHH_RUNLOCK(hhh, rmpt) rm_runlock(&(hhh)->hhh_lock, (rmpt))
93 hhook_run_hooks(struct hhook_head *hhh, void *ctx_data, struct osd *hosd)
99 KASSERT(hhh->hhh_refcount > 0, ("hhook_head %p refcount is 0", hhh));
101 HHH_RLOCK(hhh, &rmpt);
102 STAILQ_FOREACH(hhk, &hhh->hhh_hooks, hhk_next) {
120 hhk->hhk_func(hhh->hhh_type, hhh->hhh_id, hhk->hhk_udata,
123 HHH_RUNLOCK(hhh, &rmpt);
130 hhook_add_hook(struct hhook_head *hhh, const struct hookinfo *hki, uint32_t flags)
137 if (hhh == NULL)
150 HHH_WLOCK(hhh);
151 STAILQ_FOREACH(tmp, &hhh->hhh_hooks, hhk_next) {
161 STAILQ_INSERT_TAIL(&hhh->hhh_hooks, hhk, hhk_next);
162 hhh->hhh_nhooks++;
166 HHH_WUNLOCK(hhh);
189 struct hhook_head **heads_to_hook, *hhh;
206 LIST_FOREACH(hhh, &hhook_head_list, hhh_next) {
207 if (hhh->hhh_type == hki->hook_type &&
208 hhh->hhh_id == hki->hook_id) {
210 heads_to_hook[i] = hhh;
245 hhook_remove_hook(struct hhook_head *hhh, const struct hookinfo *hki)
249 if (hhh == NULL)
252 HHH_WLOCK(hhh);
253 STAILQ_FOREACH(tmp, &hhh->hhh_hooks, hhk_next) {
256 STAILQ_REMOVE(&hhh->hhh_hooks, tmp, hhook, hhk_next);
258 hhh->hhh_nhooks--;
262 HHH_WUNLOCK(hhh);
274 struct hhook_head *hhh;
277 LIST_FOREACH(hhh, &hhook_head_list, hhh_next) {
278 if (hhh->hhh_type == hki->hook_type &&
279 hhh->hhh_id == hki->hook_id)
280 hhook_remove_hook(hhh, hki);
291 hhook_head_register(int32_t hhook_type, int32_t hhook_id, struct hhook_head **hhh,
332 if (hhh != NULL)
333 *hhh = tmphhh;
341 hhook_head_destroy(struct hhook_head *hhh)
348 LIST_REMOVE(hhh, hhh_next);
350 if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
351 LIST_REMOVE(hhh, hhh_vnext);
353 HHH_WLOCK(hhh);
354 STAILQ_FOREACH_SAFE(tmp, &hhh->hhh_hooks, hhk_next, tmp2)
356 HHH_WUNLOCK(hhh);
357 HHH_LOCK_DESTROY(hhh);
358 free(hhh, M_HHOOK);
366 hhook_head_deregister(struct hhook_head *hhh)
373 if (hhh == NULL)
375 else if (hhh->hhh_refcount > 1)
378 hhook_head_destroy(hhh);
390 struct hhook_head *hhh;
393 hhh = hhook_head_get(hhook_type, hhook_id);
394 error = hhook_head_deregister(hhh);
397 hhook_head_release(hhh);
409 struct hhook_head *hhh;
412 LIST_FOREACH(hhh, &hhook_head_list, hhh_next) {
413 if (hhh->hhh_type == hhook_type && hhh->hhh_id == hhook_id) {
415 if (hhook_head_is_virtualised(hhh) ==
418 if (hhh->hhh_vid != (uintptr_t)curvnet)
422 refcount_acquire(&hhh->hhh_refcount);
428 return (hhh);
432 hhook_head_release(struct hhook_head *hhh)
435 refcount_release(&hhh->hhh_refcount);
445 hhook_head_is_virtualised(struct hhook_head *hhh)
451 if (hhh != NULL) {
452 if (hhh->hhh_flags & HHH_ISINVNET)
462 struct hhook_head *hhh;
465 hhh = hhook_head_get(hook_type, hook_id);
467 if (hhh == NULL)
470 ret = hhook_head_is_virtualised(hhh);
471 hhook_head_release(hhh);
492 struct hhook_head *hhh, *tmphhh;
500 LIST_FOREACH_SAFE(hhh, &V_hhook_vhead_list, hhh_vnext, tmphhh) {
502 __func__, hhh->hhh_type, hhh->hhh_id);
503 hhook_head_destroy(hhh);