diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-25 14:37:06 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-25 14:37:06 +0200 |
commit | 5b3151c201f4a67e998ec054d653e8177679d505 (patch) | |
tree | 4250463a8dfec187763fe684b858edf6b706d128 | |
parent | 0f2e278a8a44751594f461ee753b81da365b1147 (diff) | |
download | busybox-w32-5b3151c201f4a67e998ec054d653e8177679d505.tar.gz busybox-w32-5b3151c201f4a67e998ec054d653e8177679d505.tar.bz2 busybox-w32-5b3151c201f4a67e998ec054d653e8177679d505.zip |
modprobe-simple; do not error out on "rmmod module" if module is unloaded ok
...even if it wasn't found in /lib/modules/VER/
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | modutils/modprobe-small.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 05f2c34eb..e0d251ee9 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
@@ -18,10 +18,13 @@ extern int delete_module(const char *module, unsigned flags); | |||
18 | extern int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); | 18 | extern int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); |
19 | 19 | ||
20 | 20 | ||
21 | #define dbg1_error_msg(...) ((void)0) | 21 | #if 1 |
22 | #define dbg2_error_msg(...) ((void)0) | 22 | # define dbg1_error_msg(...) ((void)0) |
23 | //#define dbg1_error_msg(...) bb_error_msg(__VA_ARGS__) | 23 | # define dbg2_error_msg(...) ((void)0) |
24 | //#define dbg2_error_msg(...) bb_error_msg(__VA_ARGS__) | 24 | #else |
25 | # define dbg1_error_msg(...) bb_error_msg(__VA_ARGS__) | ||
26 | # define dbg2_error_msg(...) bb_error_msg(__VA_ARGS__) | ||
27 | #endif | ||
25 | 28 | ||
26 | #define DEPFILE_BB CONFIG_DEFAULT_DEPMOD_FILE".bb" | 29 | #define DEPFILE_BB CONFIG_DEFAULT_DEPMOD_FILE".bb" |
27 | 30 | ||
@@ -579,10 +582,9 @@ static void process_module(char *name, const char *cmdline_options) | |||
579 | 582 | ||
580 | /* rmmod? unload it by name */ | 583 | /* rmmod? unload it by name */ |
581 | if (is_rmmod) { | 584 | if (is_rmmod) { |
582 | if (delete_module(name, O_NONBLOCK | O_EXCL) != 0 | 585 | if (delete_module(name, O_NONBLOCK | O_EXCL) != 0) { |
583 | && !(option_mask32 & OPT_q) | 586 | if (!(option_mask32 & OPT_q)) |
584 | ) { | 587 | bb_perror_msg("remove '%s'", name); |
585 | bb_perror_msg("remove '%s'", name); | ||
586 | goto ret; | 588 | goto ret; |
587 | } | 589 | } |
588 | /* N.B. we do not stop here - | 590 | /* N.B. we do not stop here - |
@@ -594,9 +596,9 @@ static void process_module(char *name, const char *cmdline_options) | |||
594 | 596 | ||
595 | if (!info) { | 597 | if (!info) { |
596 | /* both dirscan and find_alias found nothing */ | 598 | /* both dirscan and find_alias found nothing */ |
597 | if (applet_name[0] != 'd') /* it wasn't depmod */ | 599 | if (!is_rmmod && applet_name[0] != 'd') /* it wasn't rmmod or depmod */ |
598 | bb_error_msg("module '%s' not found", name); | 600 | bb_error_msg("module '%s' not found", name); |
599 | //TODO: _and_die()? | 601 | //TODO: _and_die()? or should we continue (un)loading modules listed on cmdline? |
600 | goto ret; | 602 | goto ret; |
601 | } | 603 | } |
602 | 604 | ||
@@ -811,8 +813,8 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
811 | /* Load/remove modules. | 813 | /* Load/remove modules. |
812 | * Only rmmod loops here, modprobe has only argv[0] */ | 814 | * Only rmmod loops here, modprobe has only argv[0] */ |
813 | do { | 815 | do { |
814 | process_module(*argv++, options); | 816 | process_module(*argv, options); |
815 | } while (*argv); | 817 | } while (*++argv); |
816 | 818 | ||
817 | if (ENABLE_FEATURE_CLEAN_UP) { | 819 | if (ENABLE_FEATURE_CLEAN_UP) { |
818 | IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);) | 820 | IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);) |