summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2018-12-08 23:32:23 +0900
committerLudovic Courtès <ludo@gnu.org>2019-01-17 14:04:26 +0100
commit8ae7044f1d6a8c6a8a91ae6c032030e1affc9772 (patch)
tree4cd67debbbd2c8d8411ad88c7d57ac4d1b2ca40b
parentdf3664f1ec9a8b3c59c0e61f197798c2dda986e3 (diff)
downloadguix-8ae7044f1d6a8c6a8a91ae6c032030e1affc9772.tar.gz
file-systems: Add read-luks-partition-uuid.
Add a specific procedure to read luks partition uuid.

* gnu/build/file-systems.scm (luks-partition-field-reader): New procedure ...
(luks-partition-uuid-predicate): ... used here,
(read-luks-partition-uuid): new exported procedure.
-rw-r--r--gnu/build/file-systems.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index ee8e8146b2..c468144170 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -44,6 +44,7 @@
 
             read-partition-label
             read-partition-uuid
+            read-luks-partition-uuid
 
             bind-mount
 
@@ -438,6 +439,12 @@ partition field reader that returned a value."
 (define read-partition-uuid
   (cut read-partition-field <> %partition-uuid-readers))
 
+(define luks-partition-field-reader
+  (partition-field-reader read-luks-header luks-header-uuid))
+
+(define read-luks-partition-uuid
+  (cut read-partition-field <> (list luks-partition-field-reader)))
+
 (define (partition-predicate reader =)
   "Return a predicate that returns true if the FIELD of partition header that
 was READ is = to the given value."
@@ -454,9 +461,7 @@ was READ is = to the given value."
   (partition-predicate read-partition-uuid uuid=?))
 
 (define luks-partition-uuid-predicate
-  (partition-predicate
-   (partition-field-reader read-luks-header luks-header-uuid)
-   uuid=?))
+  (partition-predicate luks-partition-field-reader uuid=?))
 
 (define (find-partition predicate)
   "Return the first partition found that matches PREDICATE, or #f if none