Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.

From: Ludovic Courtès <[email-masked]>
Date: Sat, 26 Jan 2019 16:19:15 +0100

Danny Milosavljevic <[email-masked]> skribis:

> On Sat, 26 Jan 2019 15:10:27 +0100
> Ludovic Courtès <[email-masked]> wrote:
>
>> Danny Milosavljevic <[email-masked]> skribis:
>> 
>> > scheme> (module-soft-dependencies "/tmp/vfio.ko")  
>> > $2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))  
>> 
>> That’s probably not the best interface.  :-)
>> 
>> Perhaps it should return two values: the list of modules to be loaded
>> before (“pre”), followed by the list of modules to be loaded after
>> (“post”).
>
> I had thought about it - but for our use case it makes it slower and more
> complicated.

Once you have the result above, you can simply do:

  (partition (match-lambda
               (("pre" . _) #t)
               (("post" . _) #f))
             $2)

and then remove the cars.  Or you can fold over the elements instead of
constructing the alist in the first place.

Anyway it should be a few more lines at most, I think.

Ludo’.