>From 0cd4f6fb19c96a6be4a0d0851e1cf6dfd7046a27 Mon Sep 17 00:00:00 2001 Message-ID: <0cd4f6fb19c96a6be4a0d0851e1cf6dfd7046a27.1703992381.git.nathan_mail@nborghese.com> In-Reply-To: <626930cbad11e7f5546589fc290b2c95fee97b80.1703992381.git.nathan_mail@nborghese.com> References: <626930cbad11e7f5546589fc290b2c95fee97b80.1703992381.git.nathan_mail@nborghese.com> From: nathan Date: Sat, 30 Dec 2023 22:12:19 -0500 Subject: [PATCH 3/3] linux-modules: Rewrite module-black-list with parse-kernel-cmdline * gnu/build/linux-modules.scm (module-black-list): Use parse-kernel-cmdline. Strip quotes from module names. Normalize module names so they can be properly compared with strings from file-name->module-name. Change-Id: I318006f98844593863246fc89ed1703767794702 --- gnu/build/linux-modules.scm | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index a54616b2d4..cbce3394e2 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -397,18 +397,25 @@ (define (module-black-list) is specified using 'modprobe.blacklist=MODULE1,MODULE2,...' on the kernel command line; it is honored by libkmod for users that pass 'KMOD_PROBE_APPLY_BLACKLIST', which includes 'modprobe --use-blacklist' and -udev." - (define parameter - "modprobe.blacklist=") - - (let ((command (call-with-input-file "/proc/cmdline" - get-string-all))) - (append-map (lambda (arg) - (if (string-prefix? parameter arg) - (string-tokenize (string-drop arg (string-length parameter)) - %not-comma) - '())) - (string-tokenize command)))) +udev. The names in the returned list are normalized with `normalize-module-name'." + (define target-parameter "blacklist=") + + (let* ((cmdline (parse-kernel-cmdline (call-with-input-file "/proc/cmdline" + get-string-all))) + (modprobe-pair (vhash-assoc "modprobe" cmdline))) + (if modprobe-pair + (map normalize-module-name + (append-map + (lambda (param) + (if (string-prefix? target-parameter param) + (string-tokenize + (string-delete + #\" + (string-drop param (string-length target-parameter))) + %not-comma) + '())) + (cdr modprobe-pair))) + '()))) (define (module-loaded? module) "Return #t if MODULE is already loaded. MODULE must be a Linux module name, -- 2.41.0