all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 34195-done@debbugs.gnu.org
Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
Date: Sat, 26 Jan 2019 16:00:36 +0100	[thread overview]
Message-ID: <20190126160036.17dda684@scratchpost.org> (raw)
In-Reply-To: <87womrjyr0.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2207 bytes --]

Hi Ludo,

On Sat, 26 Jan 2019 15:10:27 +0100
Ludovic Courtès <ludo@gnu.org> wrote:

> Danny Milosavljevic <dannym@scratchpost.org> 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.

I still have the previous version (see below).

Moreover, it did the wrong thing for multiple 'softdep sections.

I guess I can use an external grouper routine (something like a hypothetical
group-by-first - does it exist?) on the result of module-soft-dependencies.

But at that point the caller can call it himself :->

We could hard-code "pre" and "post" as the two only possible sections (and
kmod does), but that would make it break in the future even though we don't
care about the sections, just the module names.

Complicated version:

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

  (define (parse-softdep text)
    (let loop ((value '())
               (tokens (string-tokenize text not-softdep-whitespace))
               (section #f))
      (write tokens)
      (newline)
      (match tokens
       ((token _ ...)
        (if (string=? (string-take-right token 1) ":") ; section
            (loop (acons (string-drop-right token 1) '() value)
                  (cdr tokens)
                  (string-trim-both token))
            (loop (add-to-first-acons token value)
                  (cdr tokens) section)))
       (()
        value))))

  (let ((info (modinfo-section-contents file)))
    (filter-map (match-lambda
                 (('softdep . value)
                  (parse-softdep value))
                 (_ #f))
                (modinfo-section-contents file))))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-01-26 15:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 19:48 bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Vagrant Cascadian
2019-01-23 10:54 ` Ludovic Courtès
2019-01-23 17:48   ` Vagrant Cascadian
2019-01-25  8:59     ` Ludovic Courtès
2019-01-25 11:30       ` [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies Danny Milosavljevic
2019-01-25 11:48         ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies Danny Milosavljevic
2019-01-25 17:07           ` Ludovic Courtès
2019-01-25 17:25             ` bug#34195: " Danny Milosavljevic
2019-01-26 14:10               ` [bug#34195] " Ludovic Courtès
2019-01-26 15:00                 ` Danny Milosavljevic [this message]
2019-01-26 15:19                   ` Ludovic Courtès
2019-01-26 16:19                     ` [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists Danny Milosavljevic
2019-01-26 16:23                       ` [bug#34195] [PATCH v2] " Danny Milosavljevic
2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
2019-01-23 17:57     ` Efraim Flashner
2019-01-25  8:49       ` Ludovic Courtès
2019-01-23 20:58 ` Mark H Weaver
2019-01-24  0:44   ` Vagrant Cascadian
2019-01-24  4:02     ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190126160036.17dda684@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=34195-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.