summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorMikhail Tsykalov <tsymsh@gmail.com>2020-11-06 12:47:37 +0300
committerLudovic Courtès <ludo@gnu.org>2020-11-26 00:05:39 +0100
commit788df2ecd62d5c2fc0d94928f45c947e6393e20b (patch)
treec91868513806a53c7780b835fd767282cec31ebe /gnu/system.scm
parent0a1da4652d9bb93d530ca52710f30b5d05a4251d (diff)
downloadguix-788df2ecd62d5c2fc0d94928f45c947e6393e20b.tar.gz
mapped-devices: Allow target to be list of strings.
* gnu/system/mapped-devices.scm (<mapped-device>): Rename constructor to
%mapped-device.
[target]: Remove field.
[targets]: New field. Adjust users.
(mapped-device-compatibility-helper, mapped-device): New macros.
(mapped-device-target): New deprecated procedure.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index b257ea0385..fcf3310fa3 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -475,9 +475,9 @@ marked as 'needed-for-boot'."
     (let ((device (file-system-device fs)))
       (if (string? device)                        ;title is 'device
           (filter (lambda (md)
-                    (string=? (string-append "/dev/mapper/"
-                                             (mapped-device-target md))
-                              device))
+                    (any (cut string=? device <>)
+                         (map (cut string-append "/dev/mapper" <>)
+                              (mapped-device-targets md))))
                   (operating-system-mapped-devices os))
           '())))
 
@@ -497,11 +497,12 @@ marked as 'needed-for-boot'."
 
 (define (mapped-device-users device file-systems)
   "Return the subset of FILE-SYSTEMS that use DEVICE."
-  (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
+  (let ((targets (map (cut string-append "/dev/mapper/" <>)
+                      (mapped-device-targets device))))
     (filter (lambda (fs)
               (or (member device (file-system-dependencies fs))
                   (and (string? (file-system-device fs))
-                       (string=? (file-system-device fs) target))))
+                       (any (cut string=? (file-system-device fs) <>) targets))))
             file-systems)))
 
 (define (operating-system-user-mapped-devices os)