From patchwork Tue Aug 2 11:23:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 41087 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3652B27BBEA; Tue, 2 Aug 2022 12:25:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9453727BBE9 for ; Tue, 2 Aug 2022 12:25:52 +0100 (BST) Received: from localhost ([::1]:54546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIq23-0005Im-Ny for patchwork@mira.cbaines.net; Tue, 02 Aug 2022 07:25:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIq0I-0003w0-G3 for guix-patches@gnu.org; Tue, 02 Aug 2022 07:24:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIq0I-0006du-7C for guix-patches@gnu.org; Tue, 02 Aug 2022 07:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIq0I-0004ip-3K for guix-patches@gnu.org; Tue, 02 Aug 2022 07:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56880] [PATCH] gnu: system: file-systems: Add shared flag. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Aug 2022 11:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56880 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56880@debbugs.gnu.org Cc: Oleg Pykhalov X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165943942118105 (code B ref -1); Tue, 02 Aug 2022 11:24:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Aug 2022 11:23:41 +0000 Received: from localhost ([127.0.0.1]:42621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIpzw-0004hx-Pb for submit@debbugs.gnu.org; Tue, 02 Aug 2022 07:23:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:40126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIpzt-0004ho-Pp for submit@debbugs.gnu.org; Tue, 02 Aug 2022 07:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIpzt-0003p8-9V for guix-patches@gnu.org; Tue, 02 Aug 2022 07:23:37 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:35708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIpzr-0006ah-HY for guix-patches@gnu.org; Tue, 02 Aug 2022 07:23:37 -0400 Received: by mail-lj1-x229.google.com with SMTP id r14so15299045ljp.2 for ; Tue, 02 Aug 2022 04:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=SYDtzaZCM1fPNQkDpol6W2O7XDXyRxROLUjHYsS5gPk=; b=mJtOGOfHy6hnIRVn7LoN3TiHvGnbrcgQ2aQi6Dd2kruoU2+jQufXzYtjtj7K7YNiFV 8bjfr2x3+F2QXmjFAHPxp+sChjB3vOA07Pz6qJNKiLGEOlU6DPreLXqYxHocCbcq8JIl t2KSAcTQNAdeM9DzqE6XiZdCGw1zqpxoCYW6QBeQEKNmf8Fzo6wmrUqqXW5jf2oJtPch z4LC8w5qk17rOGq4Macv4n9Gg9mJFUwid20YtgvtVPIP0AE/Hb6Cmw/nn68LbdHfRlAR EUdrGeZ6iTThcfoTLEoBNMRF457njlMW4C4dFQe1REZ5okMgj9lWilEtDIFOP/HZ0QOt 6qOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=SYDtzaZCM1fPNQkDpol6W2O7XDXyRxROLUjHYsS5gPk=; b=FaWsPO/vPdDu8WtWq5Y+v1+8nicoBPIKeYGlEEnufgG8Hr/hJLJK8jgR0nnGaqkzyH Spo+RrsCAdbvjQJERFP+33sYEa3rMoZDzyl74QHUoVIIIX28gvON64FXo1U6uije75hy vyvZy4EGIgmpzVMGFZh3rT66VqkTWWl45yc84XdlEuWaPDXD6lQmCslJNhSKflO4x2nt q8jf4ZGieXuCOa2FUAjnffp4YoPLx4OzaI5DbSRIrX4IAKbVIAm+3FeoqFnrFxjo55ji q0Nz3ISD4NVa/ndFSyrDiJ6LAQrhn7+SDo79YbhVtfLS6Hx4rYt6SHIlxyyFJEOxt8J+ OdRQ== X-Gm-Message-State: AJIora/jGSetcOVHqaYYKPXq3+/VxAXM92oseGh6gVm0sHUGagfuj2MN DofemiACEcg8n4/4CnlcpBpWbVa8+Tw= X-Google-Smtp-Source: AGRyM1s14SZOrvjepJVAF75tXRrUgSjEwTBkB4W2XGV7ow9uQl3RVonPU2sKLiZWY81iV+QZh6wRyQ== X-Received: by 2002:a05:651c:b13:b0:25d:8342:e11 with SMTP id b19-20020a05651c0b1300b0025d83420e11mr6053396ljr.266.1659439411436; Tue, 02 Aug 2022 04:23:31 -0700 (PDT) Received: from guixsd.wugi.info ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id j7-20020a2e6e07000000b0025e65b3b24csm54936ljc.4.2022.08.02.04.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 04:23:30 -0700 (PDT) From: Oleg Pykhalov Date: Tue, 2 Aug 2022 14:23:09 +0300 Message-Id: <20220802112309.28423-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=go.wigust@gmail.com; helo=mail-lj1-x229.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/build/file-systems.scm (mount-flags->bit-mask, mount-file-system): Handle shared flag. * gnu/system/file-systems.scm (invalid-file-system-flags): Add shared to known flags. * guix/build/syscalls.scm (MS_SHARED): New variable. (option-string->mount-flags): Handle shared flag. * doc/guix.texi (File Systems): Document shared flag. --- doc/guix.texi | 5 +++-- gnu/build/file-systems.scm | 6 ++++++ gnu/system/file-systems.scm | 4 +++- guix/build/syscalls.scm | 6 +++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9d17050ffc..106ab428d9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16376,8 +16376,9 @@ include @code{read-only}, @code{bind-mount}, @code{no-dev} (disallow access to special files), @code{no-suid} (ignore setuid and setgid bits), @code{no-atime} (do not update file access times), @code{strict-atime} (update file access time), @code{lazy-time} (only -update time on the in-memory version of the file inode), and -@code{no-exec} (disallow program execution). +update time on the in-memory version of the file inode), +@code{no-exec} (disallow program execution), and @code{shared} (make the +mount shared). @xref{Mount-Unmount-Remount,,, libc, The GNU C Library Reference Manual}, for more information on these flags. diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 1d3b33e7bd..b9d46c9350 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019–2021 Tobias Geerinckx-Rice ;;; Copyright © 2019 David C. Trudgian ;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2022 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -1123,6 +1124,8 @@ (define (mount-flags->bit-mask flags) (logior MS_STRICTATIME (loop rest))) (('lazy-time rest ...) (logior MS_LAZYTIME (loop rest))) + (('shared rest ...) + (loop rest)) (() 0)))) @@ -1186,6 +1189,9 @@ (define (mount-nfs source mount-point type flags options) (cond ((string-prefix? "nfs" type) (mount-nfs source target type flags options)) + ((memq 'shared (file-system-flags fs)) + (mount source target type flags options) + (mount "none" target #f MS_SHARED)) (else (mount source target type flags options))) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index f8f4276283..464b76a2ca 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; Copyright © 2021 Tobias Geerinckx-Rice +;;; Copyright © 2022 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -121,7 +122,8 @@ (define invalid-file-system-flags ;; Note: Keep in sync with 'mount-flags->bit-mask'. (let ((known-flags '(read-only bind-mount no-suid no-dev no-exec - no-atime strict-atime lazy-time))) + no-atime strict-atime lazy-time + shared))) (lambda (flags) "Return the subset of FLAGS that is invalid." (remove (cut memq <> known-flags) flags)))) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index a7401fd73f..ef0b1d67fd 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 Chris Marusich ;;; Copyright © 2021 Tobias Geerinckx-Rice +;;; Copyright © 2022 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,6 +50,7 @@ (define-module (guix build syscalls) MS_RELATIME MS_BIND MS_MOVE + MS_SHARED MS_LAZYTIME MNT_FORCE MNT_DETACH @@ -537,6 +539,7 @@ (define MS_REMOUNT 32) (define MS_NOATIME 1024) (define MS_BIND 4096) (define MS_MOVE 8192) +(define MS_SHARED 1048576) (define MS_RELATIME 2097152) (define MS_STRICTATIME 16777216) (define MS_LAZYTIME 33554432) @@ -637,7 +640,8 @@ (define lst ("nodev" => MS_NODEV) ("noexec" => MS_NOEXEC) ("relatime" => MS_RELATIME) - ("noatime" => MS_NOATIME))))))) + ("noatime" => MS_NOATIME) + ("shared" => MS_SHARED))))))) (define (mount-flags mount) "Return the mount flags of MOUNT, a record, as an inclusive or of