> > It allows to configure kernel modules parameters from uci config
> > files.
>
> Interesting. But is it really good to have a separate config file for
> each module? This can lead to collisions (if a module has the same
> name as a different config file); also, a set of config files without
> any common pattern would be hard to use in an UI frontend.
Look at the end of this mail for a patch adapted to this configuration.
The way it is done here with a call to "uci show" for each module
implies the config file is opened and parsed each iteration. With a
file per kernel module the config is parsed only for configured modules.
Maybe it would be more efficient to use config_load and callbacks to do
this, but I don't know exactly how yet.
>
> Maybe a single config file with sections for each module would be
> better? Something like this:
>
> config kernel-module scsi_mod
> option inq_timeout 60
>
> config kernel-module coolmod2
> option param1 1
> option param2 42
Then the patch looks like this if the config file is named
"kernel_modules":
diff --git a/package/base-files/files/etc/functions.sh
b/package/base-files/files/etc/functions.sh
index 0314692..c7bbbcb 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -165,7 +165,13 @@ config_foreach() {
load_modules() {
[ -d /etc/modules.d ] && {
cd /etc/modules.d
- sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
+ for mod in $(sed 's/^#.*//' $*)
+ do
+ uci show kernel_modules.$mod 2>/dev/null \
+ | sed -n 's/[^.]*\.[^.]*\.\([^.]*=[^.]*\)/\1/p' \
+ | xargs insmod $mod 2>/dev/null \
+ || :
+ done
}
}
_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel