From 6c31b6a061020a0b6af0aba28674a2e37516e6b3 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 30 Sep 2009 17:22:11 +0100 Subject: [PATCH] modprobe: clean up mit_ignore_loaded flag in rmmod() handle_module() clears mit_ignore_loaded before calling rmmod(). So we didn't really want to set it in the first place! Also, rmmod() uses the flag to mean something which differs both from the name itself, and the way it is used in insmod(). Replace the mit_ignore_loaded in rmmod() with a new flag mit_quiet_inuse (it means not to complain if the module cannot be removed because it is in use). Signed-off-by: Alan Jenkins --- modprobe.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modprobe.c b/modprobe.c index 6743759..6cf51bd 100644 --- a/modprobe.c +++ b/modprobe.c @@ -68,9 +68,10 @@ typedef enum mit_use_blacklist = 8, mit_ignore_commands = 16, mit_ignore_loaded = 32, - mit_strip_vermagic = 64, - mit_strip_modversion = 128, - mit_resolve_alias = 256 + mit_quiet_inuse = 64, + mit_strip_vermagic = 128, + mit_strip_modversion = 256, + mit_resolve_alias = 512 } modprobe_flags_t; @@ -1335,7 +1336,7 @@ static void rmmod(struct list_head *list, } if (usecount != 0) { - if (!(flags & mit_ignore_loaded)) + if (!(flags & mit_quiet_inuse)) error("Module %s is in use.\n", name); goto remove_rest; } @@ -1358,7 +1359,7 @@ static void rmmod(struct list_head *list, if (!list_empty(list)) { flags &= ~mit_first_time; flags &= ~mit_ignore_commands; - flags |= mit_ignore_loaded; + flags |= mit_quiet_inuse; rmmod(list, NULL, commands, "", warn, flags); } @@ -1397,10 +1398,9 @@ static int handle_module(const char *modname, return 1; } - if (flags & mit_remove) { - flags &= ~mit_ignore_loaded; + if (flags & mit_remove) rmmod(todo_list, newname, commands, cmdline_opts, error, flags); - } else + else insmod(todo_list, NOFAIL(strdup(options)), newname, modoptions, commands, cmdline_opts, error, flags); -- 2.11.4.GIT