summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system/linux-initrd.scm3
-rw-r--r--gnu/system/mapped-devices.scm14
2 files changed, 12 insertions, 5 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 72da8e55d30..17c2e6f6bfd 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -229,7 +229,8 @@ upon error."
229 (targets (mapped-device-targets md)) 229 (targets (mapped-device-targets md))
230 (type (mapped-device-type md)) 230 (type (mapped-device-type md))
231 (open (mapped-device-kind-open type))) 231 (open (mapped-device-kind-open type)))
232 (open source targets))) 232 (apply open source targets
233 (mapped-device-arguments md))))
233 mapped-devices)) 234 mapped-devices))
234 235
235 (define file-system-scan-commands 236 (define file-system-scan-commands
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 667a4955703..c09a0f1ef17 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014-2022, 2024 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2014-2022, 2024-2025 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2016 Andreas Enge <andreas@enge.fr> 3;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
4;;; Copyright © 2017, 2018 Mark H Weaver <mhw@netris.org> 4;;; Copyright © 2017, 2018 Mark H Weaver <mhw@netris.org>
5;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> 5;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
@@ -51,6 +51,7 @@
51 mapped-device-target 51 mapped-device-target
52 mapped-device-targets 52 mapped-device-targets
53 mapped-device-type 53 mapped-device-type
54 mapped-device-arguments
54 mapped-device-location 55 mapped-device-location
55 56
56 mapped-device-kind 57 mapped-device-kind
@@ -83,6 +84,8 @@
83 (source mapped-device-source) ;string | list of strings 84 (source mapped-device-source) ;string | list of strings
84 (targets mapped-device-targets) ;list of strings 85 (targets mapped-device-targets) ;list of strings
85 (type mapped-device-type) ;<mapped-device-kind> 86 (type mapped-device-type) ;<mapped-device-kind>
87 (arguments mapped-device-arguments ;list passed to open/close/check
88 (default '()))
86 (location mapped-device-location 89 (location mapped-device-location
87 (default (current-source-location)) (innate))) 90 (default (current-source-location)) (innate)))
88 91
@@ -128,13 +131,16 @@ specifications to 'targets'."
128 'device-mapping 131 'device-mapping
129 (match-lambda 132 (match-lambda
130 (($ <mapped-device> source targets 133 (($ <mapped-device> source targets
131 ($ <mapped-device-type> open close modules)) 134 ($ <mapped-device-type> open close modules)
135 arguments)
132 (shepherd-service 136 (shepherd-service
133 (provision (list (symbol-append 'device-mapping- (string->symbol (string-join targets "-"))))) 137 (provision (list (symbol-append 'device-mapping- (string->symbol (string-join targets "-")))))
134 (requirement '(udev)) 138 (requirement '(udev))
135 (documentation "Map a device node using Linux's device mapper.") 139 (documentation "Map a device node using Linux's device mapper.")
136 (start #~(lambda () #$(open source targets))) 140 (start #~(lambda ()
137 (stop #~(lambda _ (not #$(close source targets)))) 141 #$(apply open source targets arguments)))
142 (stop #~(lambda _
143 (not #$(apply close source targets arguments))))
138 (modules (append %default-modules modules)) 144 (modules (append %default-modules modules))
139 (respawn? #f)))) 145 (respawn? #f))))
140 (description "Map a device node using Linux's device mapper."))) 146 (description "Map a device node using Linux's device mapper.")))