guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: file-systems: Add a 'dependencies' field to <file-system>.


From: Ludovic Courtès
Subject: 01/05: file-systems: Add a 'dependencies' field to <file-system>.
Date: Fri, 17 Jul 2015 22:25:50 +0000

civodul pushed a commit to branch master
in repository guix.

commit e51710d1efd406890285907876ad20ec787394b3
Author: Ludovic Courtès <address@hidden>
Date:   Fri Jul 17 19:24:15 2015 +0200

    file-systems: Add a 'dependencies' field to <file-system>.
    
    * gnu/system/file-systems.scm (<file-system>)[dependencies]: New field.
    * gnu/system.scm (other-file-system-services)[requirements]: Honor
      'file-system-dependencies'.
    * doc/guix.texi (File Systems): Document it.
---
 doc/guix.texi               |    8 ++++++++
 gnu/system.scm              |   14 ++++++++++----
 gnu/system/file-systems.scm |    6 +++++-
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2f8c52c..0d24b12 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5027,6 +5027,14 @@ errors before being mounted.
 @item @code{create-mount-point?} (default: @code{#f})
 When true, the mount point is created if it does not exist yet.
 
address@hidden @code{dependencies} (default: @code{'()})
+This is a list of @code{<file-system>} objects representing file systems
+that must be mounted before (and unmounted after) this one.
+
+As an example, consider a hierarchy of mounts: @file{/sys/fs/cgroup} is
+a dependency of @file{/sys/fs/cgroup/cpu} and
address@hidden/sys/fs/cgroup/memory}.
+
 @end table
 @end deftp
 
diff --git a/gnu/system.scm b/gnu/system.scm
index ed37c32..cf9ee12 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -228,10 +228,16 @@ as 'needed-for-boot'."
             (operating-system-mapped-devices os)))
 
   (define (requirements fs)
-    (map (lambda (md)
-           (symbol-append 'device-mapping-
-                          (string->symbol (mapped-device-target md))))
-         (device-mappings fs)))
+    ;; XXX: Fiddling with dmd service names is not nice.
+    (append (map (lambda (fs)
+                   (symbol-append 'file-system-
+                                  (string->symbol
+                                   (file-system-mount-point fs))))
+                 (file-system-dependencies fs))
+            (map (lambda (md)
+                   (symbol-append 'device-mapping-
+                                  (string->symbol (mapped-device-target md))))
+                 (device-mappings fs))))
 
   (sequence %store-monad
             (map (lambda (fs)
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 0f3e6fb..a3230dc 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -37,6 +37,7 @@
             file-system-options
             file-system-check?
             file-system-create-mount-point?
+            file-system-dependencies
 
             file-system->spec
             string->uuid
@@ -97,7 +98,10 @@
   (check?           file-system-check?            ; Boolean
                     (default #t))
   (create-mount-point? file-system-create-mount-point? ; Boolean
-                       (default #f)))
+                       (default #f))
+  (dependencies     file-system-dependencies      ; list of strings (mount
+                                                  ; points depended on)
+                    (default '())))
 
 (define-inlinable (file-system-needed-for-boot? fs)
   "Return true if FS has the 'needed-for-boot?' flag set, or if it's the root



reply via email to

[Prev in Thread] Current Thread [Next in Thread]