We use <mapped-device-type> records to represent the different types of mapped devices (LUKS, RAID, LVM). When variables are defined for these records, we can distinguish them with eq?; when they are created by procedures, like luks-device-mapping-with-options, this does not work. Therefore, add a 'name' field to <mapped-device-type> to distinguish them.
* gnu/system/mapped-devices.scm (<mapped-device-type>): Add name field. (luks-device-mapping, raid-device-mapping, lvm-device-mapping): Initialize it with appropriate values for each of these types. * gnu/system.scm (operating-system-bootloader-crypto-devices): Use it to identify LUKS mapped devices. Change-Id: I4c85824f74316f07239374d9df6c007dd47a9d0c --- I've tested this on my system; in conjunction with [1], I can finally mount my LUKS volume with the no_read_workqueue and no_write_workqueue flags. [1] [bug#77499] [PATCH] mapped-devices/luks: Support extra options. https://issues.guix.gnu.org/77499 https://yhetil.org/guix/fb637872bd14abe305d810b9d32e0db290b26dd6.1743702237.git.45mg.wri...@gmail.com/ gnu/system.scm | 6 ++++-- gnu/system/mapped-devices.scm | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 0d98e5a036..87247f06ee 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomew...@protonmail.com> ;;; Copyright © 2023 Bruno Victal <mi...@makinata.eu> ;;; Copyright © 2024 Nicolas Graves <ngra...@ngraves.fr> +;;; Copyright © 2025 45mg <45mg.wri...@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -676,8 +677,9 @@ (define operating-system-bootloader-crypto-devices "Return the sources of the LUKS mapped devices specified by UUID." ;; XXX: Device ordering is important, we trust the returned one. (let* ((luks-devices (filter (lambda (m) - (eq? luks-device-mapping - (mapped-device-type m))) + (eq? (mapped-device-kind-name + (mapped-device-type m)) + 'luks)) (operating-system-boot-mapped-devices os))) (uuid-crypto-devices non-uuid-crypto-devices (partition (compose uuid? mapped-device-source) diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 667a495570..50626b8df9 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 Andreas Enge <andr...@enge.fr> ;;; Copyright © 2017, 2018 Mark H Weaver <m...@netris.org> ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> +;;; Copyright © 2025 45mg <45mg.wri...@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,6 +56,7 @@ (define-module (gnu system mapped-devices) mapped-device-kind mapped-device-kind? + mapped-device-kind-name mapped-device-kind-open mapped-device-kind-close mapped-device-kind-modules @@ -110,6 +112,7 @@ (define-deprecated (mapped-device-target md) (define-record-type* <mapped-device-type> mapped-device-kind make-mapped-device-kind mapped-device-kind? + (name mapped-device-kind-name) (open mapped-device-kind-open) ;source target -> gexp (close mapped-device-kind-close ;source target -> gexp (default (const #~(const #f)))) @@ -283,6 +286,7 @@ (define* (check-luks-device md #:key (define luks-device-mapping ;; The type of LUKS mapped devices. (mapped-device-kind + (name 'luks) (open open-luks-device) (close close-luks-device) (check check-luks-device) @@ -338,6 +342,7 @@ (define (close-raid-device sources targets) (define raid-device-mapping ;; The type of RAID mapped devices. (mapped-device-kind + (name 'raid) (open open-raid-device) (close close-raid-device))) @@ -358,6 +363,7 @@ (define (close-lvm-device source targets) (define lvm-device-mapping (mapped-device-kind + (name 'lvm) (open open-lvm-device) (close close-lvm-device) (modules '((srfi srfi-1))))) base-commit: 0b754ceeded322e8079130e6793b0c68356967cf -- 2.49.0