summary refs log tree commit diff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2021-11-15 20:26:29 +0000
committerLudovic Courtès <ludo@gnu.org>2021-11-23 10:24:27 +0100
commit0831dfab75b4db9c8bcbc9b2d1e52d8db54d0ad9 (patch)
treeaef9cfe9d813c6ddbada36230eb07fa8fe9c4bea /gnu/services/base.scm
parentf574dbd163f8b2d417c6d7ee08559626ae52b7c5 (diff)
downloadguix-0831dfab75b4db9c8bcbc9b2d1e52d8db54d0ad9.tar.gz
system: Add swap flags.
* gnu/system/file-systems.scm (swap-space)[priority, discard?]: Add
them.
* guix/build/syscalls.scm (SWAP_FLAG_PREFER, SWAP_FLAG_PRIO_MASK,
SWAP_FLAG_PRIO_SHIFT, SWAP_FLAG_DISCARD): Add them.
* gnu/build/file-systems.scm (swap-space->flags-bit-mask): Add it.
* gnu/services/base.scm (swap-service-type): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 35f38c7e09..20736eb13f 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -58,7 +58,8 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages terminals)
   #:use-module ((gnu build file-systems)
-                #:select (mount-flags->bit-mask))
+                #:select (mount-flags->bit-mask
+                          swap-space->flags-bit-mask))
   #:use-module (guix gexp)
   #:use-module (guix records)
   #:use-module (guix modules)
@@ -2223,7 +2224,9 @@ instance."
                    (let ((device #$device-lookup))
                      (and device
                           (begin
-                            (restart-on-EINTR (swapon device))
+                            (restart-on-EINTR (swapon device
+                                                      #$(swap-space->flags-bit-mask
+                                                         swap)))
                             #t)))))
         (stop #~(lambda _
                   (let ((device #$device-lookup))