~ruther/guix-local

4b494878380920c8c7eecccd1f299164dd4a2c3f — Oleg Pykhalov 4 years ago 97cb43e
gnu: system: file-systems: Add shared flag.

* 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.
* doc/guix.texi (File Systems): Document shared flag.
4 files changed, 15 insertions(+), 3 deletions(-)

M doc/guix.texi
M gnu/build/file-systems.scm
M gnu/system/file-systems.scm
M guix/build/syscalls.scm
M doc/guix.texi => doc/guix.texi +3 -2
@@ 16421,8 16421,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.


M gnu/build/file-systems.scm => gnu/build/file-systems.scm +6 -0
@@ 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 @@ corresponds to the symbols listed in FLAGS."
       (logior MS_STRICTATIME (loop rest)))
      (('lazy-time rest ...)
       (logior MS_LAZYTIME (loop rest)))
      (('shared rest ...)
       (loop rest))
      (()
       0))))



@@ 1186,6 1189,9 @@ corresponds to the symbols listed in FLAGS."
        (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)))


M gnu/system/file-systems.scm => gnu/system/file-systems.scm +3 -1
@@ 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 @@
    ;; 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))))

M guix/build/syscalls.scm => guix/build/syscalls.scm +3 -0
@@ 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 @@
            MS_RELATIME
            MS_BIND
            MS_MOVE
            MS_SHARED
            MS_LAZYTIME
            MNT_FORCE
            MNT_DETACH


@@ 537,6 539,7 @@ the last argument of `mknod'."
(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)