From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:39351) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJdST-000600-Rs for guix-patches@gnu.org; Wed, 01 Apr 2020 09:31:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJdSR-0007wt-Fv for guix-patches@gnu.org; Wed, 01 Apr 2020 09:31:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJdSR-0007w0-DJ for guix-patches@gnu.org; Wed, 01 Apr 2020 09:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jJdSQ-00015A-9D for guix-patches@gnu.org; Wed, 01 Apr 2020 09:31:02 -0400 Subject: [bug#40274] [PATCH v4] gnu: Add kernel-module-loader-service. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:39215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJdRu-0005xZ-KW for guix-patches@gnu.org; Wed, 01 Apr 2020 09:30:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJdRt-0007KA-Di for guix-patches@gnu.org; Wed, 01 Apr 2020 09:30:30 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44118) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJdRt-0007Im-55 for guix-patches@gnu.org; Wed, 01 Apr 2020 09:30:29 -0400 Received: by mail-wr1-x441.google.com with SMTP id m17so30525294wrw.11 for ; Wed, 01 Apr 2020 06:30:29 -0700 (PDT) References: <20200328135908.2540-1-brice@waegenei.re> <20200331202340.10054-1-brice@waegenei.re> From: Mathieu Othacehe In-reply-to: <20200331202340.10054-1-brice@waegenei.re> Date: Wed, 01 Apr 2020 15:30:25 +0200 Message-ID: <87k12zcozy.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 40274@debbugs.gnu.org Hello Brice, > +@deffn {Scheme Procedure} kernel-module-loader-service @var{modules} > +Return a service that run @command{modprobe} with arguments ^ runs > +@var{modules} at boot. For example loading the drivers provided by ^ What's modules? > +@deffn {Scheme Variable} kernel-module-loader-service-type > +The service type for loading kernel modules at boot with > +@command{modprobe}, for module that can't autoload. Its value must be a ^ modules You can add a separator here, C-q C-l with Emacs :) > +;;; > +;;; Kernel module loader. > +;;; > + (modprobe kernel-module-loader-configuration-modprobe ; path of the 'modprobe' command > + (default (file-append kmod "/bin/modprobe"))) > + (modules kernel-module-loader-configuration-modules ; list of lists of strings > + (default '()))) Those lines are above the 78 columns limit. > + > +(define kernel-module-loader-shepherd-service > + (match-lambda > + (($ modprobe modules) > + (list > + (shepherd-service > + (documentation "Load kernel modules.") > + (provision '(kernel-module-loader)) > + (respawn? #f) > + (one-shot? #t) > + (start > + #~(lambda _ > + (and-map (lambda (module-with-parameters) > + (zero? (apply system* #$modprobe "--" > + module-with-parameters))) > + '#$modules)))))))) I wonder if it would make sense to rmmod the modules on service stop? Probably not. > (value (run-loadable-kernel-modules-test > (list acpi-call-linux-module ddcci-driver-linux) > - '("acpi_call" "ddcci"))))) > + '(("acpi_call") > + ("ddcci")))))) When using multiple modules without any configuration, I find the notation '(("module-a") ("module-b")) a bit unclear. Maybe we could add a special case handling '("module-a" "module-b") as two kernel modules taking no arguments. Or we could define a record with two fields: module-name and arguments. Not sure what's better. Anyway, this looks good to me :). But let's wait for Danny opinion maybe. Thanks, Mathieu