modules: get rid of printing each module on Linux

Now that we respect the module blacklists, don't print every module we
try to load, because it might not end up loaded due to the blacklist,
and modprobe doesn't consider that a failure.
This commit is contained in:
William Hubbs 2016-12-18 01:13:48 +00:00
parent 856eafb006
commit abe552b969

View File

@ -31,7 +31,7 @@ FreeBSD_modules()
Linux_modules() Linux_modules()
{ {
# Should not fail if kernel do not have module # Should not fail if kernel does not have module
# support compiled in ... # support compiled in ...
[ ! -f /proc/modules ] && return 0 [ ! -f /proc/modules ] && return 0
@ -48,22 +48,21 @@ Linux_modules()
x=${x%.*} x=${x%.*}
done done
local list= x= xx= y= args= mpargs= cnt=0 a= local list= x= xx= y= args= mpargs= a=
for x in $kv_variant_list ; do for x in $kv_variant_list ; do
eval list=\$modules_$(shell_var "$x") eval list=\$modules_$(shell_var "$x")
[ -n "$list" ] && break [ -n "$list" ] && break
done done
[ -z "$list" ] && list=$modules [ -z "$list" ] && list=$modules
[ -n "$list" ] && ebegin "Loading kernel modules"
for x in $list; do for x in $list; do
a=${x#*:} a=${x#*:}
if [ "$a" = "$x" ]; then if [ "$a" = "$x" ]; then
unset mpargs unset mpargs
ebegin "Loading module $x"
else else
x=${x%%:*} x=${x%%:*}
mpargs="-o $a" mpargs="-o $a"
ebegin "Loading module $x as $a"
fi fi
aa=$(shell_var "$a") aa=$(shell_var "$a")
xx=$(shell_var "$x") xx=$(shell_var "$x")
@ -75,10 +74,9 @@ Linux_modules()
done done
[ -z "$args" ] && eval args=\$module_${aa}_args [ -z "$args" ] && eval args=\$module_${aa}_args
[ -z "$args" ] && eval args=\$module_${xx}_args [ -z "$args" ] && eval args=\$module_${xx}_args
eval modprobe --use-blacklist -q "$mpargs" "$x" "$args" eval modprobe --use-blacklist --verbose "$mpargs" "$x" "$args"
eend $? "Failed to load $x" && : $(( cnt += 1 ))
done done
einfo "Autoloaded $cnt module(s)" [ -n "$list" ] && eend
} }
start() start()