1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-24 01:51:51 +02:00

syscalls: Add 'mounts' and the <mount> record type.

* guix/build/syscalls.scm (<mount>): New record type.
(option-string->mount-flags, mount-flags)
(octal-decode, mounts): New procedures.
(mount-points): Rewrite in terms of 'mount'.
* tests/syscalls.scm ("mounts"): New test.
This commit is contained in:
Ludovic Courtès
2021-02-22 15:20:41 +01:00
parent 46bb1a41ae
commit 7e9d9f28e9
2 changed files with 121 additions and 7 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2020 Simon South <simon@simonsouth.net>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -56,6 +56,20 @@
;; Both return values have been encountered in the wild.
(memv (system-error-errno args) (list EPERM ENOENT)))))
(test-assert "mounts"
;; Check for one of the common mount points.
(let ((mounts (mounts)))
(any (match-lambda
((point . type)
(let ((mount (find (lambda (mount)
(string=? (mount-point mount) point))
mounts)))
(and mount
(string=? (mount-type mount) type)))))
'(("/proc" . "proc")
("/sys" . "sysfs")
("/dev/shm" . "tmpfs")))))
(test-assert "mount-points"
;; Reportedly "/" is not always listed as a mount point, so check a few
;; others (see <http://bugs.gnu.org/20261>.)