summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_module.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-11-19 19:43:56 +0000
committerattilio <attilio@FreeBSD.org>2010-11-19 19:43:56 +0000
commit4902b4f43a670eb338c672582e233d12c19937c9 (patch)
tree0bc4a6c3e9b449e8a1c63aa58ae54726b4b4ba02 /sys/kern/kern_module.c
parenta38574dd9cbdab512c286f7ffc4d7bb0f2d18d70 (diff)
downloadFreeBSD-src-4902b4f43a670eb338c672582e233d12c19937c9.zip
FreeBSD-src-4902b4f43a670eb338c672582e233d12c19937c9.tar.gz
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
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r--sys/kern/kern_module.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index 1869867..11fa909 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -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;
struct module {
TAILQ_ENTRY(module) link; /* chain together all modules */
TAILQ_ENTRY(module) flink; /* all modules in a file */
@@ -101,7 +101,7 @@ module_shutdown(void *arg1, int arg2)
return;
mtx_lock(&Giant);
MOD_SLOCK;
- TAILQ_FOREACH(mod, &modules, link)
+ TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link)
MOD_EVENT(mod, MOD_SHUTDOWN);
MOD_SUNLOCK;
mtx_unlock(&Giant);
OpenPOWER on IntegriCloud