2010/11/19 John Baldwin <j...@freebsd.org>: > On Friday, November 19, 2010 4:27:27 pm Attilio Rao wrote: >> 2010/11/19 John Baldwin <j...@freebsd.org>: >> > On Friday, November 19, 2010 2:43:57 pm Attilio Rao wrote: >> >> Author: attilio >> >> Date: Fri Nov 19 19:43:56 2010 >> >> New Revision: 215544 >> >> URL: http://svn.freebsd.org/changeset/base/215544 >> >> >> >> Log: >> >> Scan the list in reverse order for the shutdown handlers of loaded >> >> modules. >> >> This way, when there is a dependency between two modules, the handler >> >> of the >> >> latter probed runs first. >> >> >> >> This is a similar approach as the modules are unloaded in the same >> >> linkerfile. >> >> >> >> Sponsored by: Sandvine Incorporated >> >> Submitted by: Nima Misaghian <nmisaghian at sandvine dot com> >> >> MFC after: 1 week >> >> >> >> Modified: >> >> head/sys/kern/kern_module.c >> >> >> >> Modified: head/sys/kern/kern_module.c >> >> ============================================================================== >> >> --- head/sys/kern/kern_module.c Fri Nov 19 18:59:35 2010 >> >> (r215543) >> >> +++ head/sys/kern/kern_module.c Fri Nov 19 19:43:56 2010 >> >> (r215544) >> >> @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); >> >> >> >> static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); >> >> >> >> -typedef TAILQ_HEAD(, module) modulelist_t; >> >> +typedef TAILQ_HEAD(modulelst, module) modulelist_t; >> > >> > Is modulelist already taken? If not, we should probably just retire >> > 'modulelist_t' and replace it with 'struct modulelist'. >> >> Note that I used modulelst, not modulelist. >> Probabilly, if you think the name may be still confusing, we can >> pickup one another further. > > Yes, I'd much prefer 'modulelist' with the extra 'i' as it is more readable. > If you go that route, I think you can drop modulelist_t since style(9) > discourages foo_t types unless they are required by a standard.
I think that this patch should make it? Thanks, Attilio Index: sys/kern/kern_module.c =================================================================== --- sys/kern/kern_module.c (revision 215544) +++ sys/kern/kern_module.c (working copy) @@ -46,7 +46,6 @@ static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); -typedef TAILQ_HEAD(modulelst, module) modulelist_t; struct module { TAILQ_ENTRY(module) link; /* chain together all modules */ TAILQ_ENTRY(module) flink; /* all modules in a file */ @@ -61,7 +60,7 @@ #define MOD_EVENT(mod, type) (mod)->handler((mod), (type), (mod)->arg) -static modulelist_t modules; +static TAILQ_HEAD(modulelist, module) modules; struct sx modules_sx; static int nextid = 1; static void module_shutdown(void *, int); @@ -101,7 +100,7 @@ return; mtx_lock(&Giant); MOD_SLOCK; - TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link) + TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link) MOD_EVENT(mod, MOD_SHUTDOWN); MOD_SUNLOCK; mtx_unlock(&Giant); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"