[Bug 5162] New: modprobe-small: rmmod is removing dependencies

bugzilla at busybox.net bugzilla at busybox.net
Mon Apr 30 14:16:48 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=5162

           Summary: modprobe-small: rmmod is removing dependencies
           Product: Busybox
           Version: 1.19.x
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Standard Compliance
        AssignedTo: unassigned at busybox.net
        ReportedBy: tysen.moore at xs-embedded.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


Created attachment 4316
  --> https://bugs.busybox.net/attachment.cgi?id=4316
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);

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list