[arch-projects] [PATCH] init: leverage blacklisting in /run/modprobe.d

Dave Reisner d at falconindy.com
Thu Jun 2 15:28:53 EDT 2011


Simplify the code used to generate and read from the early userspace
blacklist by turning the contents of the $disablemodules variable into
/run/modprobe.d/initcpio.conf. This removes the need for the loop in
parsing the $MODULES variable -- we simply invoke modprobe with -b, to
respect any blacklisting.

Signed-off-by: Dave Reisner <d at falconindy.com>
---
This is some low hanging fruit I noticed after the last patch I submitted.
Requires module-init-tools 3.13.


 init |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/init b/init
index 87ff187..d2c2d9b 100644
--- a/init
+++ b/init
@@ -46,9 +46,7 @@ if [ -n "${disablehooks}" ]; then
 fi
 
 if [ -n "${disablemodules}" ]; then
-    for d in $(echo "${disablemodules}" | sed 's|,| |g'); do
-        eval "mod_${d}=disabled"
-    done
+    printf 'blacklist %s\n' ${disablemodules//,/ } > /run/modprobe.d/initcpio.conf
 fi
 
 if [ -n "${earlymodules}" ]; then
@@ -59,13 +57,7 @@ fi
 
 . /config
 
-for m in ${MODULES}; do
-    TST=""
-    eval "TST=\$mod_${m}"
-    if [ "${TST}" != "disabled" ]; then
-        /sbin/modprobe -q ${m} > /dev/null 2>&1
-    fi
-done
+/sbin/modprobe -qab $MODULES
 
 # If rootdelay is empty or not a non-negative integer, set it to 10
 if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then
-- 
1.7.5.2



More information about the arch-projects mailing list