From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id IFapMIAHtl5vGgAA0tVLHw (envelope-from ) for ; Sat, 09 May 2020 01:29:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id GJxcKI0Htl7eJQAAB5/wlQ (envelope-from ) for ; Sat, 09 May 2020 01:29:49 +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 652D4940D58 for ; Sat, 9 May 2020 01:29:47 +0000 (UTC) Received: from localhost ([::1]:48870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXEJG-00015D-Pc for larch@yhetil.org; Fri, 08 May 2020 21:29:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXE34-0003tL-Fx for guix-patches@gnu.org; Fri, 08 May 2020 21:13:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXE34-000429-65 for guix-patches@gnu.org; Fri, 08 May 2020 21:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jXE34-0007E9-0C for guix-patches@gnu.org; Fri, 08 May 2020 21:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41143] [PATCH 1/2] mapped-devices: Allow target to be list of strings Resent-From: tsmish Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 May 2020 01:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41143 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41143@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158898677927771 (code B ref -1); Sat, 09 May 2020 01:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 May 2020 01:12:59 +0000 Received: from localhost ([127.0.0.1]:46511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXE31-0007Dr-IP for submit@debbugs.gnu.org; Fri, 08 May 2020 21:12:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:51774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jXE2z-0007Dg-8K for submit@debbugs.gnu.org; Fri, 08 May 2020 21:12:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXE2z-0003tF-3H for guix-patches@gnu.org; Fri, 08 May 2020 21:12:57 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:36746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXE2y-0003s6-13 for guix-patches@gnu.org; Fri, 08 May 2020 21:12:56 -0400 Received: by mail-qt1-x841.google.com with SMTP id v4so2187389qte.3 for ; Fri, 08 May 2020 18:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=pbsQsvhfv4gk/g0/3WrPPyVyeBtSIC4dhO1eo0oDjfg=; b=EvX16I4qS1uFt9Ozm2VHFVqLqNEdDEoY08tuzbUzQSrGO7Rz/PYPZwVPlfcj/lP0A9 XO0fXCjdRgte1JS9ENdkK8582/s9F+1Ye1ABmwaNmOu8BxIJRGrR/sRt2yN5nqIawvJt ebNmkVgfLVPoqI7Dl1odTieMsAhVyweHpUxa8EwzTQ5Q9k/xgloCMY/ks9FkbS24ehq0 j8u4ef8uGqrYnCYa2MuS6DwkYMt8QQghNM1/fGlDJiW4uLBzU3jUgWSIu2dpEIoNRGib V70oo3EKaz/8E9u9u1R9IK9kQ3t8+367jhuJ8SRAQPEGZgep3GFx8UgEqG7gIa2+tl72 Tnqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=pbsQsvhfv4gk/g0/3WrPPyVyeBtSIC4dhO1eo0oDjfg=; b=QdnSDqYmznWEvZjUhq1rz0N4yYmvguf9SL8P62s6D9CIgMJVrlLPpwCvijeDDkPZ9h zc9WQ3gSl4mgvKqZkxRbLOVK61D4T6NGERFZ2TG1pqHCdfThKx3fTS8Pi2hfoR7+U96W WHr2AuSWs6OGOQLUy0VK5aBzCDr8LhIMm3EEjZvJJKZlcY0InWyO6DDl2ihWwVjl0a3M +kAj0K5MVkon8HQHxG0XqaIIdIhyVEXGq8Xf+A0ngoDzXuRJjrdjpUbCNMEQQ5sIbpXV n50rzs+KCufr7LHMhdUqbs51jSvqIK20JXzpdqdkI3OD53z+oqEbLhDi3w++nwRxsucA t2Zg== X-Gm-Message-State: AGi0PuYYHJa00DzbyK/KnIqCG+gj2PajqSeCJTIz37b8USHtKfR1B4fd lxpipe5s/QvWCJPZ/n/oX43943r6LklTv5qWrNxNL117 X-Google-Smtp-Source: APiQypL1Z9F+xuTbqJv19eknpy/ZEBKgiFajVDINt99p73/7sjpggOorgZsqcEUZVeDcjFMkPG2bVYg8K4bsaSHylpI= X-Received: by 2002:ac8:2c78:: with SMTP id e53mr6191492qta.365.1588986774409; Fri, 08 May 2020 18:12:54 -0700 (PDT) MIME-Version: 1.0 From: tsmish Date: Sat, 9 May 2020 01:12:43 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=tsymsh@gmail.com; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.3 (--) X-Mailman-Approved-At: Fri, 08 May 2020 21:29:37 -0400 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: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=EvX16I4q; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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-Scan-Result: default: False [0.09 / 13.00]; GENERIC_REPUTATION(0.00)[-0.54028387829135]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.09), country: US(-0.00), ip: 209.51.188.17(-0.54)]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[tsymsh@gmail.com,guix-patches-bounces@gnu.org]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[10]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: X2Gr+FPq9mVn (let ...) stuff should be in function, but I don't know in which module it should go. Code is somewhat untested, proceed with caution. --- gnu/services/base.scm | 5 ++++- gnu/system.scm | 13 ++++++++----- gnu/system/mapped-devices.scm | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 0c154d1c4e..3d09e8220c 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -408,7 +408,10 @@ FILE-SYSTEM." (define (mapped-device->shepherd-service-name md) "Return the symbol that denotes the shepherd service of MD, a ." (symbol-append 'device-mapping- - (string->symbol (mapped-device-target md)))) + (string->symbol (string-join + (let ((t (mapped-device-target md))) + (if (list? t) t (list t))) + "-")))) (define dependency->shepherd-service-name (match-lambda diff --git a/gnu/system.scm b/gnu/system.scm index 01baa248a2..75632c5e8a 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -390,9 +390,10 @@ marked as 'needed-for-boot'." (let ((device (file-system-device fs))) (if (string? device) ;title is 'device (filter (lambda (md) - (string=? (string-append "/dev/mapper/" - (mapped-device-target md)) - device)) + (any (cut string=? device <>) + (map (cut string-append "/dev/mapper" <>) + (let ((t (mapped-device-target md))) + (if (list? t) t (list t)))))) (operating-system-mapped-devices os)) '()))) @@ -412,11 +413,13 @@ marked as 'needed-for-boot'." (define (mapped-device-users device file-systems) "Return the subset of FILE-SYSTEMS that use DEVICE." - (let ((target (string-append "/dev/mapper/" (mapped-device-target device)))) + (let ((targets (map (cut string-append "/dev/mapper/" <>) + (let ((t (mapped-device-target device))) + (if (list? t) t (list t)))))) (filter (lambda (fs) (or (member device (file-system-dependencies fs)) (and (string? (file-system-device fs)) - (string=? (file-system-device fs) target)))) + (any (cut string=? (file-system-device fs) <>) targets)))) file-systems))) (define (operating-system-user-mapped-devices os) diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 7c58f876a3..3339e509e0 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -72,7 +72,7 @@ make-mapped-device mapped-device? (source mapped-device-source) ;string | list of strings - (target mapped-device-target) ;string + (target mapped-device-target) ;string | list of strings (type mapped-device-type) ; (location mapped-device-location (default (current-source-location)) (innate))) -- 2.26.2