Lines Matching defs:h
39 #include <sys/param.h>
40 #include <sys/kernel.h>
41 #include <sys/hhook.h>
42 #include <sys/khelp.h>
43 #include <sys/lock.h>
44 #include <sys/malloc.h>
45 #include <sys/module.h>
46 #include <sys/module_khelp.h>
47 #include <sys/osd.h>
48 #include <sys/queue.h>
49 #include <sys/refcount.h>
50 #include <sys/rwlock.h>
51 #include <sys/systm.h>
59 static inline void khelp_remove_osd(struct helper *h, struct osd *hosd);
69 khelp_register_helper(struct helper *h)
75 refcount_init(&h->h_refcount, 0);
76 h->h_id = osd_register(OSD_KHELP, NULL, NULL);
79 for (i = 0; i < h->h_nhooks && !error; i++) {
81 h->h_hooks[i].hook_helper = h;
82 error = hhook_add_hook_lookup(&h->h_hooks[i], HHOOK_WAITOK);
86 h->h_name, h->h_hooks[i].hook_type,
87 h->h_hooks[i].hook_id, error);
92 hhook_remove_hook_lookup(&h->h_hooks[i]);
93 osd_deregister(OSD_KHELP, h->h_id);
102 if (tmph->h_id < h->h_id) {
103 TAILQ_INSERT_BEFORE(tmph, h, h_next);
110 TAILQ_INSERT_TAIL(&helpers, h, h_next);
118 khelp_deregister_helper(struct helper *h)
124 if (h->h_refcount > 0)
129 if (tmph == h) {
130 TAILQ_REMOVE(&helpers, h, h_next);
139 for (i = 0; i < h->h_nhooks; i++)
140 hhook_remove_hook_lookup(&h->h_hooks[i]);
141 osd_deregister(OSD_KHELP, h->h_id);
150 struct helper *h;
159 TAILQ_FOREACH(h, &helpers, h_next) {
161 if (h->h_classes & classes && h->h_flags & HELPER_NEEDS_OSD) {
162 hdata = uma_zalloc(h->h_zone, M_NOWAIT);
167 osd_set(OSD_KHELP, hosd, h->h_id, hdata);
168 refcount_acquire(&h->h_refcount);
174 TAILQ_FOREACH(h, &helpers, h_next) {
175 if (h->h_classes & classes)
176 khelp_remove_osd(h, hosd);
187 struct helper *h;
201 TAILQ_FOREACH(h, &helpers, h_next)
202 khelp_remove_osd(h, hosd);
209 khelp_remove_osd(struct helper *h, struct osd *hosd)
213 if (h->h_flags & HELPER_NEEDS_OSD) {
219 hdata = osd_get(OSD_KHELP, hosd, h->h_id);
221 uma_zfree(h->h_zone, hdata);
222 osd_del(OSD_KHELP, hosd, h->h_id);
223 refcount_release(&h->h_refcount);
238 struct helper *h;
244 TAILQ_FOREACH(h, &helpers, h_next) {
245 if (strncmp(h->h_name, hname, HELPER_NAME_MAXLEN) == 0) {
246 id = h->h_id;
290 struct helper *h;
294 TAILQ_FOREACH(h, &helpers, h_next) {
295 for (i = 0; i < h->h_nhooks; i++) {
296 if (hhh->hhh_type != h->h_hooks[i].hook_type ||
297 hhh->hhh_id != h->h_hooks[i].hook_id)
299 error = hhook_add_hook(hhh, &h->h_hooks[i], flags);
303 __func__, h->h_name,
304 h->h_hooks[i].hook_type,
305 h->h_hooks[i].hook_id, error);