[PATCH] [qos-scripts] Reload modules with parameters specified
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 20 May 2009 21:10:45 +0000 (21:10 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 20 May 2009 21:10:45 +0000 (21:10 +0000)
This patch makes qos-scripts reload a module when there is need to pass some
parameters to it. It fixes an issue on devices with more than two interfaces where
many IMQ devices are needed but the module is already loaded with the
default numdevs=2
Signed-off-by: Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
SVN-Revision: 15945

package/qos-scripts/files/usr/lib/qos/generate.sh

index 6c52027a6a2c5f8c20b361628e5eb8f69b1395ca..94c01d46196a304182262f03bf4c54befba18b51 100755 (executable)
@@ -1,12 +1,21 @@
 #!/bin/sh
 [ -e /etc/functions.sh ] && . /etc/functions.sh || . ./functions.sh
-[ -x /sbin/modprobe ] && insmod="modprobe" || insmod="insmod"
+[ -x /sbin/modprobe ] && {
+       insmod="modprobe"
+       rmmod="$insmod -r"
+} || {
+       insmod="insmod"
+       rmmod="rmmod"
+}
 
 add_insmod() {
        eval "export isset=\${insmod_$1}"
        case "$isset" in
                1) ;;
-               *) append INSMOD "$insmod $* >&- 2>&-" "$N"; export insmod_$1=1;;
+               *) {
+                       [ "$2" ] && append INSMOD "$rmmod $1 >&- 2>&-" "$N"
+                       append INSMOD "$insmod $* >&- 2>&-" "$N"; export insmod_$1=1
+               };;
        esac
 }