From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id kJrDICKeK2cIYAEA62LTzQ:P1 (envelope-from ) for ; Wed, 06 Nov 2024 16:49:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id kJrDICKeK2cIYAEA62LTzQ (envelope-from ) for ; Wed, 06 Nov 2024 17:49:38 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=t0c9fm5X; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=Y2QIOVc6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730911778; a=rsa-sha256; cv=none; b=HEbeIP5aa4ZBWwrBwaxgH42SE6ln+RlLv+33DcjVcnvQk+NYBWhtLGnW33bikzVJCk+TSr Yn0kym3SGxC2IKxtYWnvla2t12IBIlHGZHmQEDclqUNXVUSYlUejK4wzjSk/jX9iopBrWa gqnNXD3wTYkx/2Z9uVtuoYwzSWa4j3OP4p8upLjk+GdolJ4rOJSsEgzH6y5Mwzf2ECcnqO xK06Y+4VB3mk/mU2Wuo5uN2qBfmjZqekCQOOcnxytYzl4QTS+GLxLsTUCFoeIDpxuMUqCT DXB54guftu+dEp9IKao7cl+o6X5qiBwh8wIjqK2X0k7ydOKsBRx2wC8ZqhYktg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=t0c9fm5X; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=Y2QIOVc6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730911778; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YCpXCOexKzuVmkEr4oDInF0UQH1vkExOBNuwWdeuPe0=; b=NsWM27eQ+3C0+IRAlYW1uMKX3DqjpqwgXQ5oArXT1Wmm3KmGQxDl3ji5ECUrMBr48SDH+I bWYe54TxJ0m8fnDkTNeLmxdJneGAsdWuWLp+QURPf70Vwj3R483W5v9gaQid9Cj2pZ0Od8 T6XPjyT2/LCxqwrxXVYo4SPQC4zwhNkPloVPn6wVOMPIxOCydCWffKMLgtwIL2H8k8vC8n TE01hnY3mBxdgovoeMf3YxypI1VP25s0mNYszfaH4Qv3RT0tWx5AnmlLWCWUx10CqADVum TuaiXlX2obNHnQ6GyYu5X7KYG1iLTTF7N9ZjwDt1UFiX8HoJixNjrvJ9/mikAw== 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 33DBC18EE0 for ; Wed, 06 Nov 2024 17:49:38 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8i3k-00053P-NX; Wed, 06 Nov 2024 10:35:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8i3i-00052l-Dp for guix-patches@gnu.org; Wed, 06 Nov 2024 10:35:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8i3i-00045e-3O for guix-patches@gnu.org; Wed, 06 Nov 2024 10:35:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=YCpXCOexKzuVmkEr4oDInF0UQH1vkExOBNuwWdeuPe0=; b=t0c9fm5Xm2l2f9jrsyd2Sfe1YRrFDCnMJdm1VgKZLd0kASOY3fbqa8kuZQaNME93LBOiIGXDH0aQdijGYb5+sGSU87PCso3mMAMIa95tSgKi4WFePVkBoSCgW+6qCFeqdTDA8cvAl3Ckt2ThLHkDt1SBmgxHeDa7PN2E2k62n58ANG/CA/ZfFXsRVICA3/oAo3+FaHIv7968Fbjcsle8Rb9ShxG7THxv9UE0dIovfuCdDdv17oOj+/a0NN6YsicN3CZl7yZcEUVgUt+mAHc/mH7/X94HmHzj5Ch72jUKqGIjq7aFYo2GbkvgrJEcZ47VxB+lec4PV1/Juh62qR2E5g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t8i3h-00060D-U8 for guix-patches@gnu.org; Wed, 06 Nov 2024 10:35:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73654] [PATCH] gnu: luks-device-mapping-with-options: Add allow-discards? argument. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Nov 2024 15:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73654 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Sisiutl Cc: 73654@debbugs.gnu.org Received: via spool by 73654-submit@debbugs.gnu.org id=B73654.173090724523002 (code B ref 73654); Wed, 06 Nov 2024 15:35:01 +0000 Received: (at 73654) by debbugs.gnu.org; 6 Nov 2024 15:34:05 +0000 Received: from localhost ([127.0.0.1]:45119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8i2m-0005yv-GB for submit@debbugs.gnu.org; Wed, 06 Nov 2024 10:34:04 -0500 Received: from mail.boiledscript.com ([144.168.59.46]:55418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8i2i-0005yQ-RC for 73654@debbugs.gnu.org; Wed, 06 Nov 2024 10:34:02 -0500 Date: Wed, 06 Nov 2024 21:57:16 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1730907233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YCpXCOexKzuVmkEr4oDInF0UQH1vkExOBNuwWdeuPe0=; b=Y2QIOVc65RJ5njPuz/hoj4AvqXDUEMZcphulWGIDHHGdjGzsW2XaZECBYUTH2fGoXHskMk X1JfQFDowndE0A85PEzTwM0MSpIxm18E9STGRtsbydekZn33PtBuWqjgKz8LaNU7lfGQa8 Na4G07qJV1DETraxpevALExCvbIojyOql+mVa02ns4pvshvZdXAqVrDaN1fNVNC6tm7MaQ 2ht2db48TcQMXXNtL0H7TtwhNX0hrO9jBSILlcItFwONi2DaFL9ioEvqqNpwwmqCBb4mBq NSKHH3NrRV1XWfTcf6m3wuDrSKjm5cbfDW1kNSCxe9xBBNnMwSEu+L5JrcyWFg== Message-ID: <87ikt0ihxf.wl-hako@ultrarare.space> In-Reply-To: <20241006094239.7157-1-sisiutl@egregore.fun> References: <20241006094239.7157-1-sisiutl@egregore.fun> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches From: Hilton Chain via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 0.56 X-Spam-Score: 0.56 X-Migadu-Queue-Id: 33DBC18EE0 X-Migadu-Scanner: mx12.migadu.com X-TUID: 7B+rEsXdGYHg Hi Sisiutl, On Sun, 06 Oct 2024 17:42:28 +0800, Sisiutl wrote: > > * gnu/system/mapped-devices.scm (luks-device-mapping-with-options): Add a= llow-discards? argument. > > Change-Id: I0a43c13570a223d17698c7fe9ef4607e587bb8d0 > --- > gnu/system/mapped-devices.scm | 36 +++++++++++++++++++---------------- > 1 file changed, 20 insertions(+), 16 deletions(-) > > diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm > index 931c371425..674e8708a4 100644 > --- a/gnu/system/mapped-devices.scm > +++ b/gnu/system/mapped-devices.scm > @@ -189,12 +189,12 @@ (define missing > (&error-location > (location (source-properties->location location)))))))) > > -=0C > + This character (=A1=0C=A2) is a form feed, please leave it here :) > ;;; > ;;; Common device mappings. > ;;; > > -(define* (open-luks-device source targets #:key key-file) > +(define* (open-luks-device source targets #:key key-file allow-discards?) > "Return a gexp that maps SOURCE to TARGET as a LUKS device, using > 'cryptsetup'." > (with-imported-modules (source-module-closure > @@ -234,17 +234,19 @@ (define* (open-luks-device source targets #:key key= -file) > (loop (- tries-left 1)))))) > (error "LUKS partition not found" source)) > source))) > - ;; We want to fallback to the password unlock if the keyfil= e fails. > - (or (and keyfile > - (zero? (system*/tty > - #$(file-append cryptsetup-static "/sbin/cr= yptsetup") > - "open" "--type" "luks" > - "--key-file" keyfile > - partition #$target))) > - (zero? (system*/tty > - #$(file-append cryptsetup-static "/sbin/cryptse= tup") > - "open" "--type" "luks" > - partition #$target))))))))) > + (let* ((cryptsetup-flags (list "open" "--type" "luks" parti= tion #$target)) > + (cryptsetup-flags (if allow-discards? > + (cons "--allow-discards" crypt= setup-flags) > + cryptsetup-flags))) > + ;; We want to fallback to the password unlock if the keyf= ile fails. > + (or (and keyfile > + (zero? (apply system*/tty > + #$(file-append cryptsetup-static "= /sbin/cryptsetup") > + "--key-file" keyfile > + cryptsetup-flags))) > + (zero? (apply system*/tty > + #$(file-append cryptsetup-static "/sbin= /cryptsetup") > + cryptsetup-flags)))))))))) > (define (close-luks-device source targets) > "Return a gexp that closes TARGET, a LUKS device." > @@ -286,13 +288,15 @@ (define luks-device-mapping > ((gnu build file-systems) > #:select (find-partition-by-luks-uuid system*/tty)))))) > > -(define* (luks-device-mapping-with-options #:key key-file) > +(define* (luks-device-mapping-with-options #:key key-file allow-discards= ?) > "Return a luks-device-mapping object with open modified to pass the ar= guments > into the open-luks-device procedure." > (mapped-device-kind > (inherit luks-device-mapping) > - (open (=EB (source targets) (open-luks-device source targets > - #:key-file key-file))))) > + (open (=EB (source targets) > + (open-luks-device source targets > + #:key-file key-file > + #:allow-discards? allow-discards?))))) > > (define (open-raid-device sources targets) > "Return a gexp that assembles SOURCES (a list of devices) to the RAID = device > -- > 2.46.0 Can you also add documentation for this option in doc/guix.texi? Thanks