From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gcMHC5vKo19GXwAA0tVLHw (envelope-from ) for ; Thu, 05 Nov 2020 09:49:15 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0MxNBpvKo1+4WwAA1q6Kng (envelope-from ) for ; Thu, 05 Nov 2020 09:49:15 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 91309940119 for ; Thu, 5 Nov 2020 09:49:14 +0000 (UTC) Received: from localhost ([::1]:56418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kabtI-0000WC-3D for larch@yhetil.org; Thu, 05 Nov 2020 04:49:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kabt8-0000Vy-CO for guix-patches@gnu.org; Thu, 05 Nov 2020 04:49:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40171) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kabt8-0006Ft-19 for guix-patches@gnu.org; Thu, 05 Nov 2020 04:49:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kabt7-0005e6-WF for guix-patches@gnu.org; Thu, 05 Nov 2020 04:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#41143] [PATCH v2 1/2] mapped-devices: Allow target to be list of strings. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 05 Nov 2020 09:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41143 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mikhail Tsykalov Cc: 41143@debbugs.gnu.org Received: via spool by 41143-submit@debbugs.gnu.org id=B41143.160456973021683 (code B ref 41143); Thu, 05 Nov 2020 09:49:01 +0000 Received: (at 41143) by debbugs.gnu.org; 5 Nov 2020 09:48:50 +0000 Received: from localhost ([127.0.0.1]:51717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kabsw-0005de-5E for submit@debbugs.gnu.org; Thu, 05 Nov 2020 04:48:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kabst-0005dQ-9M for 41143@debbugs.gnu.org; Thu, 05 Nov 2020 04:48:49 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54073) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kabsn-0006Ax-Vh; Thu, 05 Nov 2020 04:48:41 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=34600 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kabsn-0007d0-E9; Thu, 05 Nov 2020 04:48:41 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87pn69j09o.fsf@gnu.org> <20201001224900.28989-1-tsymsh@gmail.com> <874knaffov.fsf@gnu.org> Date: Thu, 05 Nov 2020 10:48:39 +0100 In-Reply-To: <874knaffov.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sun, 04 Oct 2020 12:28:32 +0200") Message-ID: <87o8kc5e2w.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: Oc3VQVmDDWt9 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=E2=80=99. Ludovic Court=C3=A8s skribis: > Hi Mikhail, > > Mikhail Tsykalov skribis: > >> * gnu/system/mapped-devices.scm (): 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=E2=80=99re 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 =E2=80=98targets=E2=80=99 (plural) everywhere. T= hat can help > avoid confusion IMO. > >> - #$target))))) >> + #$(car target)))))) >>=20=20 >> (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=E2=80=99d recommend using =E2=80=98match=E2=80=99 > > (define (close-luks-device source targets) > (match targets > ((target) > #~(zero? (system* =E2=80=A6 #$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 =E2=80=9CMapped Devices=E2=80=9D in doc/guix.texi t= o mention the > new =E2=80=98targets=E2=80=99 field? > > Thanks, > Ludo=E2=80=99.