mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
mapped-devices: Add ‘arguments’ field.
Fixes <https://issues.guix.gnu.org/70826>. This allows users to specify extra arguments specific to the underlying mapped device type. * gnu/system/mapped-devices.scm (<mapped-device>)[arguments]: New field. (device-mapping-service-type): Honor it. * guix/scripts/system.scm (check-mapped-devices): Likewise. * gnu/system/linux-initrd.scm (raw-initrd): Likewise. * doc/guix.texi (Mapped Devices): Document it. Reported-by: 45mg <45mg.writes@gmail.com> Change-Id: Idef5a3e68535c412f13bae9a92c81c49053d4f4a
This commit is contained in:
parent
951e39718a
commit
62bf9a7cc7
4 changed files with 19 additions and 7 deletions
|
@ -18637,6 +18637,10 @@ there are several. The format is identical to @var{target}.
|
||||||
@item type
|
@item type
|
||||||
This must be a @code{mapped-device-kind} object, which specifies how
|
This must be a @code{mapped-device-kind} object, which specifies how
|
||||||
@var{source} is mapped to @var{target}.
|
@var{source} is mapped to @var{target}.
|
||||||
|
|
||||||
|
@item arguments
|
||||||
|
This is a list of arguments specific to @var{type} that are passed to
|
||||||
|
its @code{open}, @code{close}, and @code{check} procedures.
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,8 @@ upon error."
|
||||||
(targets (mapped-device-targets md))
|
(targets (mapped-device-targets md))
|
||||||
(type (mapped-device-type md))
|
(type (mapped-device-type md))
|
||||||
(open (mapped-device-kind-open type)))
|
(open (mapped-device-kind-open type)))
|
||||||
(open source targets)))
|
(apply open source targets
|
||||||
|
(mapped-device-arguments md))))
|
||||||
mapped-devices))
|
mapped-devices))
|
||||||
|
|
||||||
(define file-system-scan-commands
|
(define file-system-scan-commands
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014-2022, 2024 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014-2022, 2024-2025 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
|
;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
|
||||||
;;; Copyright © 2017, 2018 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2017, 2018 Mark H Weaver <mhw@netris.org>
|
||||||
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
|
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
mapped-device-target
|
mapped-device-target
|
||||||
mapped-device-targets
|
mapped-device-targets
|
||||||
mapped-device-type
|
mapped-device-type
|
||||||
|
mapped-device-arguments
|
||||||
mapped-device-location
|
mapped-device-location
|
||||||
|
|
||||||
mapped-device-kind
|
mapped-device-kind
|
||||||
|
@ -83,6 +84,8 @@
|
||||||
(source mapped-device-source) ;string | list of strings
|
(source mapped-device-source) ;string | list of strings
|
||||||
(targets mapped-device-targets) ;list of strings
|
(targets mapped-device-targets) ;list of strings
|
||||||
(type mapped-device-type) ;<mapped-device-kind>
|
(type mapped-device-type) ;<mapped-device-kind>
|
||||||
|
(arguments mapped-device-arguments ;list passed to open/close/check
|
||||||
|
(default '()))
|
||||||
(location mapped-device-location
|
(location mapped-device-location
|
||||||
(default (current-source-location)) (innate)))
|
(default (current-source-location)) (innate)))
|
||||||
|
|
||||||
|
@ -128,13 +131,16 @@ specifications to 'targets'."
|
||||||
'device-mapping
|
'device-mapping
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <mapped-device> source targets
|
(($ <mapped-device> source targets
|
||||||
($ <mapped-device-type> open close modules))
|
($ <mapped-device-type> open close modules)
|
||||||
|
arguments)
|
||||||
(shepherd-service
|
(shepherd-service
|
||||||
(provision (list (symbol-append 'device-mapping- (string->symbol (string-join targets "-")))))
|
(provision (list (symbol-append 'device-mapping- (string->symbol (string-join targets "-")))))
|
||||||
(requirement '(udev))
|
(requirement '(udev))
|
||||||
(documentation "Map a device node using Linux's device mapper.")
|
(documentation "Map a device node using Linux's device mapper.")
|
||||||
(start #~(lambda () #$(open source targets)))
|
(start #~(lambda ()
|
||||||
(stop #~(lambda _ (not #$(close source targets))))
|
#$(apply open source targets arguments)))
|
||||||
|
(stop #~(lambda _
|
||||||
|
(not #$(apply close source targets arguments))))
|
||||||
(modules (append %default-modules modules))
|
(modules (append %default-modules modules))
|
||||||
(respawn? #f))))
|
(respawn? #f))))
|
||||||
(description "Map a device node using Linux's device mapper.")))
|
(description "Map a device node using Linux's device mapper.")))
|
||||||
|
|
|
@ -680,9 +680,10 @@ procedure of its type."
|
||||||
(mapped-device-type md))))
|
(mapped-device-type md))))
|
||||||
;; We expect CHECK to raise an exception with a detailed
|
;; We expect CHECK to raise an exception with a detailed
|
||||||
;; '&message' if something goes wrong.
|
;; '&message' if something goes wrong.
|
||||||
(check md
|
(apply check md
|
||||||
#:needed-for-boot? (needed-for-boot? md)
|
#:needed-for-boot? (needed-for-boot? md)
|
||||||
#:initrd-modules initrd-modules)))
|
#:initrd-modules initrd-modules
|
||||||
|
(mapped-device-arguments md))))
|
||||||
(operating-system-mapped-devices os)))
|
(operating-system-mapped-devices os)))
|
||||||
|
|
||||||
(define (check-initrd-modules os)
|
(define (check-initrd-modules os)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue