[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#41143] [PATCH v2 1/2] mapped-devices: Allow target to be list of st
From: |
Ludovic Courtès |
Subject: |
[bug#41143] [PATCH v2 1/2] mapped-devices: Allow target to be list of strings. |
Date: |
Thu, 05 Nov 2020 10:48:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hi Mikhail,
Did you have a chance to look into the proposed changes?
https://issues.guix.gnu.org/41143
Would be nice to have LVM support integrated!
TIA,
Ludo’.
Ludovic Courtès <ludo@gnu.org> skribis:
> Hi Mikhail,
>
> Mikhail Tsykalov <tsymsh@gmail.com> skribis:
>
>> * 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.
>
> Thanks for following up. I think we’re almost done, some comments
> below:
>
>> --- a/gnu/system/linux-initrd.scm
>> +++ b/gnu/system/linux-initrd.scm
>> @@ -196,7 +196,7 @@ upon error."
>> ;; List of gexps to open the mapped devices.
>> (map (lambda (md)
>> (let* ((source (mapped-device-source md))
>> - (target (mapped-device-target md))
>> + (target (mapped-device-targets md))
>
> I think we should write ‘targets’ (plural) everywhere. That can help
> avoid confusion IMO.
>
>> - #$target)))))
>> + #$(car target))))))
>>
>> (define (close-luks-device source target)
>> "Return a gexp that closes TARGET, a LUKS device."
>> #~(zero? (system* #$(file-append cryptsetup-static "/sbin/cryptsetup")
>> - "close" #$target)))
>> + "close" #$(car target))))
>
> As per our coding convention (info "(guix) Data Types and Pattern
> Matching"), I’d recommend using ‘match’
>
> (define (close-luks-device source targets)
> (match targets
> ((target)
> #~(zero? (system* … #$target)))))
>
> That has the added benefit that it errors out if TARGETS is not exactly
> a one-element list.
>
>> (define (close-raid-device sources target)
>> "Return a gexp that stops the RAID device TARGET."
>> #~(zero? (system* #$(file-append mdadm-static "/sbin/mdadm")
>> - "--stop" #$target)))
>> + "--stop" #$(car target))))
>
> Same here.
>
> Could you also update “Mapped Devices” in doc/guix.texi to mention the
> new ‘targets’ field?
>
> Thanks,
> Ludo’.
- [bug#41143] [PATCH v2 1/2] mapped-devices: Allow target to be list of strings.,
Ludovic Courtès <=