Subject: [bug#40274] [PATCH v4] gnu: Add kernel-module-loader-service.

From: Brice Waegeneire <[email-masked]>
Date: Wed, 01 Apr 2020 14:38:57 +0000

Hello Mathieu,

On 2020-04-01 13:30, Mathieu Othacehe wrote:
> You can add a separator here, C-q C-l with Emacs :)

I never used pagination in Emacs, maybe I should start using it.

>> +(define kernel-module-loader-shepherd-service
>> +  (match-lambda
>> +    (($ <kernel-module-loader-configuration> 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.

This is a one-shot service so no.

>>     (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.

I asked about it on IRC before starting v2 but nobody responded so I 
went on
with this “list of lists of string” implementation. I'll be happy to use 
a
better format, the special case look nice but maybe confusing for the 
user.

I have fixed the typo you reported but I'll wait for further suggestion 
about
the format before sending the new version.

- Brice