Lines Matching refs:mod

58 #define MOD_EVENT(mod, type)	(mod)->handler((mod), (type), (mod)->arg)  argument
66 modevent_nop(module_t mod, int what, void *arg) in modevent_nop() argument
94 module_t mod; in module_shutdown() local
100 TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link) in module_shutdown()
101 MOD_EVENT(mod, MOD_SHUTDOWN); in module_shutdown()
111 module_t mod; in module_register_init() local
115 mod = module_lookupbyname(data->name); in module_register_init()
116 if (mod == NULL) in module_register_init()
120 error = MOD_EVENT(mod, MOD_LOAD); in module_register_init()
122 MOD_EVENT(mod, MOD_UNLOAD); in module_register_init()
124 module_release(mod); in module_register_init()
131 if (mod->file) { in module_register_init()
140 TAILQ_REMOVE(&mod->file->modules, mod, flink); in module_register_init()
141 TAILQ_INSERT_HEAD(&mod->file->modules, mod, flink); in module_register_init()
181 module_reference(module_t mod) in module_reference() argument
186 MOD_DPF(REFS, ("module_reference: before, refs=%d\n", mod->refs)); in module_reference()
187 mod->refs++; in module_reference()
191 module_release(module_t mod) in module_release() argument
196 if (mod->refs <= 0) in module_release()
199 MOD_DPF(REFS, ("module_release: before, refs=%d\n", mod->refs)); in module_release()
201 mod->refs--; in module_release()
202 if (mod->refs == 0) { in module_release()
203 TAILQ_REMOVE(&modules, mod, link); in module_release()
204 if (mod->file) in module_release()
205 TAILQ_REMOVE(&mod->file->modules, mod, flink); in module_release()
206 free(mod, M_MODULE); in module_release()
213 module_t mod; in module_lookupbyname() local
218 TAILQ_FOREACH(mod, &modules, link) { in module_lookupbyname()
219 err = strcmp(mod->name, name); in module_lookupbyname()
221 return (mod); in module_lookupbyname()
229 module_t mod; in module_lookupbyid() local
233 TAILQ_FOREACH(mod, &modules, link) in module_lookupbyid()
234 if (mod->id == modid) in module_lookupbyid()
235 return(mod); in module_lookupbyid()
240 module_quiesce(module_t mod) in module_quiesce() argument
245 error = MOD_EVENT(mod, MOD_QUIESCE); in module_quiesce()
253 module_unload(module_t mod) in module_unload() argument
258 error = MOD_EVENT(mod, MOD_UNLOAD); in module_unload()
264 module_getid(module_t mod) in module_getid() argument
268 return (mod->id); in module_getid()
272 module_getfnext(module_t mod) in module_getfnext() argument
276 return (TAILQ_NEXT(mod, flink)); in module_getfnext()
280 module_getname(module_t mod) in module_getname() argument
284 return (mod->name); in module_getname()
288 module_setspecific(module_t mod, modspecific_t *datap) in module_setspecific() argument
292 mod->data = *datap; in module_setspecific()
296 module_file(module_t mod) in module_file() argument
299 return (mod->file); in module_file()
308 module_t mod; in sys_modnext() local
315 mod = TAILQ_FIRST(&modules); in sys_modnext()
316 if (mod) in sys_modnext()
317 td->td_retval[0] = mod->id; in sys_modnext()
322 mod = module_lookupbyid(uap->modid); in sys_modnext()
323 if (mod == NULL) { in sys_modnext()
327 if (TAILQ_NEXT(mod, link)) in sys_modnext()
328 td->td_retval[0] = TAILQ_NEXT(mod, link)->id; in sys_modnext()
339 module_t mod; in sys_modfnext() local
345 mod = module_lookupbyid(uap->modid); in sys_modfnext()
346 if (mod == NULL) { in sys_modfnext()
350 if (TAILQ_NEXT(mod, flink)) in sys_modfnext()
351 td->td_retval[0] = TAILQ_NEXT(mod, flink)->id; in sys_modfnext()
377 module_t mod; in sys_modstat() local
387 mod = module_lookupbyid(uap->modid); in sys_modstat()
388 if (mod == NULL) { in sys_modstat()
392 id = mod->id; in sys_modstat()
393 refs = mod->refs; in sys_modstat()
394 name = mod->name; in sys_modstat()
395 data = mod->data; in sys_modstat()
408 namelen = strlen(mod->name) + 1; in sys_modstat()
451 module_t mod; in sys_modfind() local
457 mod = module_lookupbyname(name); in sys_modfind()
458 if (mod == NULL) in sys_modfind()
461 td->td_retval[0] = module_getid(mod); in sys_modfind()
501 module_t mod; in freebsd32_modstat() local
511 mod = module_lookupbyid(uap->modid); in freebsd32_modstat()
512 if (mod == NULL) { in freebsd32_modstat()
517 id = mod->id; in freebsd32_modstat()
518 refs = mod->refs; in freebsd32_modstat()
519 name = mod->name; in freebsd32_modstat()
522 CP(mod->data, data32, uintval); in freebsd32_modstat()
532 namelen = strlen(mod->name) + 1; in freebsd32_modstat()