[Top][All Lists]

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

01/01: system: Add a 'needed-for-boot?' field to 'mapped-device'.

From: Ludovic Courtès
Subject: 01/01: system: Add a 'needed-for-boot?' field to 'mapped-device'.
Date: Sat, 29 Nov 2014 13:44:00 +0000

civodul pushed a commit to branch master
in repository guix.

commit 3b09332adf7ce8e976a4d117a62c586a53af04aa
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 29 14:40:26 2014 +0100

    system: Add a 'needed-for-boot?' field to 'mapped-device'.
    * gnu/system/file-systems.scm (<mapped-device>)[needed-for-boot?]: New
    * gnu/system.scm (operating-system-user-mapped-devices,
      operating-system-boot-mapped-devices): Use it instead of trying to
      guess.  Guessing doesn't work when one refers to a partition using its
      label, for instance.
    * doc/guix.texi (Mapped Devices): Document 'needed-for-boot?'.
 doc/guix.texi               |   16 ++++++++++++----
 gnu/system.scm              |   17 ++++-------------
 gnu/system/file-systems.scm |    5 ++++-
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index aad2017..9aeec41 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3837,19 +3837,27 @@ detailed below.
 Objects of this type represent device mappings that will be made when
 the system boots up.
address@hidden @code
address@hidden source
address@hidden @asis
address@hidden @code{source}
 This string specifies the name of the block device to be mapped, such as
address@hidden target
address@hidden @code{target}
 This string specifies the name of the mapping to be established.  For
 example, specifying @code{"my-partition"} will lead to the creation of
 the @code{"/dev/mapper/my-partition"} device.
address@hidden type
address@hidden @code{type}
 This must be a @code{mapped-device-kind} object, which specifies how
 @var{source} is mapped to @var{target}.
address@hidden @code{needed-for-boot?} (default: @code{#f})
+This Boolean value indicates whether the device mapping must be made at
+boot time---i.e., from the initial RAM disk, before any user file
+systems are mounted.
+You would set it to @code{#t} for instance when the mapped device is
+used by the root file system.
 @end table
 @end deftp
diff --git a/gnu/system.scm b/gnu/system.scm
index e1ed1a2..731f9de 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -250,23 +250,14 @@ as 'needed-for-boot'."
 (define (operating-system-user-mapped-devices os)
   "Return the subset of mapped devices that can be installed in
 user-land--i.e., those not needed during boot."
-  (let ((devices      (operating-system-mapped-devices os))
-        (file-systems (operating-system-file-systems os)))
-   (filter (lambda (md)
-             (let ((user (mapped-device-user md file-systems)))
-               (or (not user)
-                   (not (file-system-needed-for-boot? user)))))
-           devices)))
+  (remove mapped-device-needed-for-boot?
+          (operating-system-mapped-devices os)))
 (define (operating-system-boot-mapped-devices os)
   "Return the subset of mapped devices that must be installed during boot,
 from the initrd."
-  (let ((devices      (operating-system-mapped-devices os))
-        (file-systems (operating-system-file-systems os)))
-   (filter (lambda (md)
-             (let ((user (mapped-device-user md file-systems)))
-               (and user (file-system-needed-for-boot? user))))
-           devices)))
+  (filter mapped-device-needed-for-boot?
+          (operating-system-mapped-devices os)))
 (define (device-mapping-services os)
   "Return the list of device-mapping services for OS as a monadic list."
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 4760821..356b482 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -45,6 +45,7 @@
+            mapped-device-needed-for-boot?
@@ -157,7 +158,9 @@ file system."
   (source    mapped-device-source)                ;string
   (target    mapped-device-target)                ;string
-  (type      mapped-device-type))                 ;<mapped-device-kind>
+  (type      mapped-device-type)                  ;<mapped-device-kind>
+  (needed-for-boot? mapped-device-needed-for-boot? ;Boolean
+                    (default #f)))
 (define-record-type* <mapped-device-type> mapped-device-kind

reply via email to

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