[arch-projects] [PATCH] init: leverage blacklisting in /run/modprobe.d
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@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
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@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.
On Thu, Jun 02, 2011 at 09:59:09PM +0200, Thomas Bächler wrote:
This is still too much. I said earlier that disablemodules= is not supported anymore, so this code needs to be removed, I just forgot.
Could you expand on this or point me to your post? I realize that we can't support load_modules=off with load-modules.sh gone, but I'm not gripping the reason that $disablemodules needs to go away as well. Isn't this is part of the reason /run/modprobe.d now exists? dave
Am 02.06.2011 22:38, schrieb Dave Reisner:
On Thu, Jun 02, 2011 at 09:59:09PM +0200, Thomas Bächler wrote:
This is still too much. I said earlier that disablemodules= is not supported anymore, so this code needs to be removed, I just forgot.
Could you expand on this or point me to your post? I realize that we can't support load_modules=off with load-modules.sh gone, but I'm not gripping the reason that $disablemodules needs to go away as well. Isn't this is part of the reason /run/modprobe.d now exists?
This syntax used to be supported for blacklisting from initscripts/udev, but now it is not. There are mechanisms for blacklisting from the command line (see Tom's post on arch-dev-public). Still supporting disablemodules= in initramfs is inconsistent.
On Thu, Jun 02, 2011 at 04:38:42PM -0400, Dave Reisner wrote:
On Thu, Jun 02, 2011 at 09:59:09PM +0200, Thomas Bächler wrote:
This is still too much. I said earlier that disablemodules= is not supported anymore, so this code needs to be removed, I just forgot.
Could you expand on this or point me to your post? I realize that we can't support load_modules=off with load-modules.sh gone, but I'm not gripping the reason that $disablemodules needs to go away as well. Isn't this is part of the reason /run/modprobe.d now exists?
dave
Nevermind. I see it: modprobe.blacklist=$modname on the cmdline. That said, I don't see the harm in supporting disablemodules but you're free to disregard my patch and rip it out entirely. dave
On Thu, Jun 2, 2011 at 11:07 PM, Dave Reisner <d@falconindy.com> wrote:
Could you expand on this or point me to your post? I realize that we can't support load_modules=off with load-modules.sh gone, but I'm not gripping the reason that $disablemodules needs to go away as well. Isn't this is part of the reason /run/modprobe.d now exists?
Just to clarify: I submitted the blacklist patch to modprobe so we would not have to parse the commandline ourselves. The reason for /run was so that we could keep supporting blacklisting in the MODULES array, but as this would not be a one-to-one correspondence with the old behavior we agreed that it was not worth it, and ripped it out altogether (which makes the /run stuff a bit pointless, but maybe someone else have a use for it...). -t
participants (3)
-
Dave Reisner
-
Thomas Bächler
-
Tom Gundersen