* Run all helper hook functions for a given hook point. */
| 93 | * Run all helper hook functions for a given hook point. |
| 94 | */ |
| 95 | void |
| 96 | hhook_run_hooks(struct hhook_head *hhh, void *ctx_data, struct osd *hosd) |
| 97 | { |
| 98 | struct hhook *hhk; |
| 99 | void *hdata; |
| 100 | struct rm_priotracker rmpt; |
| 101 | |
| 102 | KASSERT(hhh->hhh_refcount > 0, ("hhook_head %p refcount is 0", hhh)); |
| 103 | |
| 104 | HHH_RLOCK(hhh, &rmpt); |
| 105 | STAILQ_FOREACH(hhk, &hhh->hhh_hooks, hhk_next) { |
| 106 | if (hhk->hhk_helper != NULL && |
| 107 | hhk->hhk_helper->h_flags & HELPER_NEEDS_OSD) { |
| 108 | hdata = osd_get(OSD_KHELP, hosd, hhk->hhk_helper->h_id); |
| 109 | if (hdata == NULL) |
| 110 | continue; |
| 111 | } else |
| 112 | hdata = NULL; |
| 113 | |
| 114 | /* |
| 115 | * XXXLAS: We currently ignore the int returned by the hook, |
| 116 | * but will likely want to handle it in future to allow hhook to |
| 117 | * be used like pfil and effect changes at the hhook calling |
| 118 | * site e.g. we could define a new hook type of HHOOK_TYPE_PFIL |
| 119 | * and standardise what particular return values mean and set |
| 120 | * the context data to pass exactly the same information as pfil |
| 121 | * hooks currently receive, thus replicating pfil with hhook. |
| 122 | */ |
| 123 | hhk->hhk_func(hhh->hhh_type, hhh->hhh_id, hhk->hhk_udata, |
| 124 | ctx_data, hdata, hosd); |
| 125 | } |
| 126 | HHH_RUNLOCK(hhh, &rmpt); |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | * Register a new helper hook function with a helper hook point. |
no test coverage detected