emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#34195: closed ([PATCH] linux-modules: Add module-s


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#34195: closed ([PATCH] linux-modules: Add module-soft-dependencies.)
Date: Fri, 25 Jan 2019 17:26:03 +0000

Your message dated Fri, 25 Jan 2019 18:25:37 +0100
with message-id <address@hidden>
and subject line Re: [PATCH v2] linux-modules: Add modules-soft-dependencies.
has caused the debbugs.gnu.org bug report #34195,
regarding [PATCH] linux-modules: Add module-soft-dependencies.
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
34195: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34195
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] linux-modules: Add module-soft-dependencies. Date: Fri, 25 Jan 2019 12:30:32 +0100
* gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
(module-soft-dependencies): New procedure.
---
 gnu/build/linux-modules.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 2d8117504..631c5f577 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -33,6 +33,7 @@
             ensure-dot-ko
             module-aliases
             module-dependencies
+            module-soft-dependencies
             normalize-module-name
             file-name->module-name
             find-module-file
@@ -100,6 +101,42 @@ contains module names, not actual file names."
       (('depends . what)
        (string-tokenize what %not-comma)))))
 
+(define not-softdep-whitespace
+  (char-set-complement (char-set #\space #\tab)))
+
+(define (module-soft-dependencies file)
+  "Return the list of soft dependencies of module FILE."
+  (define (add-to-first-acons value alist)
+    (match alist
+      (((k . v) . b)
+       (cons (cons k (cons value v)) b))))
+
+  ;; TEXT: "pre: baz blubb foo post: bax bar"
+  (define (parse-softdep text)
+    (let loop ((value '())
+               (tokens (string-tokenize text not-softdep-whitespace))
+               (section #f))
+      (match tokens
+       ((token _ ...)
+        (if (string=? (string-take-right token 1) ":") ; section
+            (loop value
+                  (cdr tokens)
+                  (string-trim-both token))
+            (loop (cons (cons section token) value)
+                  (cdr tokens)
+                  section)))
+       (()
+        value))))
+
+  ;; Note: Multiple 'softdep sections are allowed.
+  (let ((info (modinfo-section-contents file)))
+    (apply append
+     (filter-map (match-lambda
+                  (('softdep . value)
+                   (parse-softdep value))
+                  (_ #f))
+                 (modinfo-section-contents file)))))
+
 (define (module-aliases file)
   "Return the list of aliases of module FILE."
   (let ((info (modinfo-section-contents file)))



--- End Message ---
--- Begin Message --- Subject: Re: [PATCH v2] linux-modules: Add modules-soft-dependencies. Date: Fri, 25 Jan 2019 18:25:37 +0100
Hi Ludo,

>That was fast!  :-)

Yeah, I dislike ticking boot time bombs ;-)

Thanks for the review!

Pushed as 1a5f46621b44aa1458ad7acd4eca5fe1d4574f92 
and 519be98c3536b5113cde368f9dc6db2e1ebe073e (tiny fix)
to guix master.

Note that it returns something like

(("pre" . "module-1") ("pre" . "module-2"))

So the user might want to

(1) map cdr (or match ;) ) it
(2) replace dashes by underscores if a filename is desired 
(normalize-module-name)
(although in practise nobody in the mainline Linux seems to use dashes there
right now, their example in include/linux/module.h has dashes :P)

Example result:

scheme> (module-soft-dependencies "/tmp/vfio.ko")
$2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))

Attachment: pgpavKouGKlVm.pgp
Description: OpenPGP digital signature


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]