Subject: bug#70826: [PATCH] system: Allow distinguishing <mapped-device-type>s.

From: 45mg <[email-masked]>
Date: Fri, 09 May 2025 07:56:04 +0000

Hi Ludovic,

Ludovic Courtès <[email-masked]> writes:

> Hi 45mg,
>
> Did you have a chance to look into the proposed change below?
>
> Thanks,
> Ludo’.

Sorry for the delay, I've been quite busy lately.

If I understand correctly, your proposal would make
luks-device-mapping-with-options obsolete, so users would have to change
from this:

--8<---------------cut here---------------start------------->8---
(mapped-device
 (source "/dev/sdb1")
 (target "data")
 (type (luks-device-mapping-with-options
        #:allow-discards? #t)))
--8<---------------cut here---------------end--------------->8---

to this:

--8<---------------cut here---------------start------------->8---
(mapped-device
 (source "/dev/sdb1")
 (target "data")
 (type luks-device-mapping)
 (arguments (list #:allow-discards? #t)))
--8<---------------cut here---------------end--------------->8---

Is that correct? Just trying to make sure I understand your idea.

Regarding different arguments for open, close and check methods - I
think it's fine to have a single keyword argument list like above, and
then, like you suggested, have the methods only respect the keywords
that are relevant to them (use `#:allow-other-keys #:rest keys` in the
define* form). Like you said, this would lead to extra boilerplate
(though we could reduce this by writing a procedure to inspect `keys`
for a given keyword), but I think it would be more robust.

At any rate, I should be able to work on this within two weeks at most;
feel free to ping me if I don't send a v2 by then.