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

Thomas Bächler thomas at archlinux.org
Thu Jun 2 15:59:09 EDT 2011


Am 02.06.2011 21:28, schrieb Dave Reisner:
> 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

This is still too much. I said earlier that disablemodules= is not
supported anymore, so this code needs to be removed, I just forgot.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20110602/b9547f53/attachment.asc>


More information about the arch-projects mailing list