Revert "system: Add a 'needed-for-boot?' field to 'mapped-device'."
authorLudovic Courtès <ludo@gnu.org>
Sun, 30 Nov 2014 16:50:07 +0000 (17:50 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sun, 30 Nov 2014 17:54:07 +0000 (18:54 +0100)
This reverts commit 3b09332adf7ce8e976a4d117a62c586a53af04aa, which
turned out to be a bad idea because we need to have dependency
information between the device-mapping service and the file-system
service that uses it.

doc/guix.texi
gnu/system.scm
gnu/system/file-systems.scm

index 53bfb29..7c059b9 100644 (file)
@@ -3837,27 +3837,19 @@ detailed below.
 Objects of this type represent device mappings that will be made when
 the system boots up.
 
-@table @asis
-@item @code{source}
+@table @code
+@item source
 This string specifies the name of the block device to be mapped, such as
 @code{"/dev/sda3"}.
 
-@item @code{target}
+@item 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.
 
-@item @code{type}
+@item type
 This must be a @code{mapped-device-kind} object, which specifies how
 @var{source} is mapped to @var{target}.
-
-@item @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
 
index 731f9de..e1ed1a2 100644 (file)
@@ -250,14 +250,23 @@ 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."
-  (remove mapped-device-needed-for-boot?
-          (operating-system-mapped-devices os)))
+  (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)))
 
 (define (operating-system-boot-mapped-devices os)
   "Return the subset of mapped devices that must be installed during boot,
 from the initrd."
-  (filter mapped-device-needed-for-boot?
-          (operating-system-mapped-devices os)))
+  (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)))
 
 (define (device-mapping-services os)
   "Return the list of device-mapping services for OS as a monadic list."
index 356b482..4760821 100644 (file)
@@ -45,7 +45,6 @@
             mapped-device-source
             mapped-device-target
             mapped-device-type
-            mapped-device-needed-for-boot?
 
             mapped-device-kind
             mapped-device-kind?
@@ -158,9 +157,7 @@ file system."
   mapped-device?
   (source    mapped-device-source)                ;string
   (target    mapped-device-target)                ;string
-  (type      mapped-device-type)                  ;<mapped-device-kind>
-  (needed-for-boot? mapped-device-needed-for-boot? ;Boolean
-                    (default #f)))
+  (type      mapped-device-type))                 ;<mapped-device-kind>
 
 (define-record-type* <mapped-device-type> mapped-device-kind
   make-mapped-device-kind