From: Oleg Pykhalov <go.wigust@gmail.com>
To: 56880@debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust@gmail.com>
Subject: [bug#56880] [PATCH] gnu: system: file-systems: Add shared flag.
Date: Tue, 2 Aug 2022 14:23:09 +0300 [thread overview]
Message-ID: <20220802112309.28423-1-go.wigust@gmail.com> (raw)
* 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 <me@tobias.gr>
;;; Copyright © 2019 David C. Trudgian <dave@trudgian.net>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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 <kuba@kadziolka.net>
;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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 <janneke@gnu.org>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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 <mount> record, as an inclusive or of
--
2.37.0
next reply other threads:[~2022-08-02 11:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 11:23 Oleg Pykhalov [this message]
2022-08-03 15:21 ` [bug#56880] [PATCH] gnu: system: file-systems: Add shared flag Ludovic Courtès
2022-08-04 13:20 ` Oleg Pykhalov
2022-08-05 9:41 ` Ludovic Courtès
2022-08-10 4:19 ` bug#56880: " Oleg Pykhalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220802112309.28423-1-go.wigust@gmail.com \
--to=go.wigust@gmail.com \
--cc=56880@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.