diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-31 15:19:37 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-06-04 21:47:35 -0400 |
commit | 2c02dfe7fe3fba97a5665d329d039d2415ea5607 (patch) | |
tree | 7f50644bbfcc119cb85e21642a76eabfaf77b8ad /include | |
parent | ad8456361fa19068cf49b50a4f98e41b73c08e76 (diff) |
module: Make the 'usage' lists be two-way
When adding a module that depends on another one, we used to create a
one-way list of "modules_which_use_me", so that module unloading could
see who needs a module.
It's actually quite simple to make that list go both ways: so that we
not only can see "who uses me", but also see a list of modules that are
"used by me".
In fact, we always wanted that list in "module_unload_free()": when we
unload a module, we want to also release all the other modules that are
used by that module. But because we didn't have that list, we used to
first iterate over all modules, and then iterate over each "used by me"
list of that module.
By making the list two-way, we simplify module_unload_free(), and it
allows for some trivial fixes later too.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cleaned & rebased)
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/module.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 6914fcad4673..680db9e2ac36 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -359,7 +359,9 @@ struct module | |||
359 | 359 | ||
360 | #ifdef CONFIG_MODULE_UNLOAD | 360 | #ifdef CONFIG_MODULE_UNLOAD |
361 | /* What modules depend on me? */ | 361 | /* What modules depend on me? */ |
362 | struct list_head modules_which_use_me; | 362 | struct list_head source_list; |
363 | /* What modules do I depend on? */ | ||
364 | struct list_head target_list; | ||
363 | 365 | ||
364 | /* Who is waiting for us to be unloaded */ | 366 | /* Who is waiting for us to be unloaded */ |
365 | struct task_struct *waiter; | 367 | struct task_struct *waiter; |