| Summary: | modprobe-small: rmmod is removing dependencies | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | tysen.moore |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.19.x | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | patch file found in bug description | ||
No need to have OPT_m bit, we can check applet's name 1st char
+ if (applet_name[0] == 'r') {
+ /* rmmod: do not remove dependencies, exit */
+ goto ret;
+ }
Fixed in git:
commit 06a98e32ae930a4e332281b42b6bb769dcadc04e
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date: Tue Sep 25 20:37:38 2012 +0200
modprobe_small: make rmmod to NOT remove dependencies
|
Created attachment 4316 [details] patch file found in bug description When using the modprobe-small option the rmmod works the same as "modprobe -r". I don't know if this is the design intent but it does not match the busybox (normal) rmmod functionality as well as non-busybox rmmod. I have a proposed solution below (also attached): --- busybox-1.19.2/modutils/modprobe-small.c 2011-08-21 22:57:49.000000000 -0400 +++ new/modutils/modprobe-small.c 2012-04-27 14:57:01.000000000 -0400 @@ -37,6 +37,7 @@ extern int query_module(const char *name enum { OPT_q = (1 << 0), /* be quiet */ OPT_r = (1 << 1), /* module removal instead of loading */ + OPT_m = (1 << 2), /* modprobe, not rmmod */ }; typedef struct module_info { @@ -594,7 +595,12 @@ static void process_module(char *name, c bb_perror_msg("remove '%s'", name); goto ret; } - /* N.B. we do not stop here - + + if ((option_mask32 & OPT_m) == 0) { + /* rmmod is not supposed to remove dependencied, exit */ + goto ret; + } + /* else, N.B. we do not stop here - * continue to unload modules on which the module depends: * "-r --remove: option causes modprobe to remove a module. * If the modules it depends on are also unused, modprobe @@ -813,6 +819,11 @@ int modprobe_main(int argc UNUSED_PARAM, option_mask32 |= OPT_r; } + /* indicate this is an actual modprobe call */ + if ('m' == applet0) { + option_mask32 |= OPT_m; + } + if ('i' != applet0) { /* not insmod */ /* Goto $VERSION directory */ xchdir(uts.release);