aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/uuid.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-04 21:34:09 +0200
committerLudovic Courtès <ludo@gnu.org>2017-10-05 12:09:17 +0200
commitaed1f1b049f6e7ef9f2f2db58bdca6cd3effe94b (patch)
treeee6ee785d2113ef13e593459fdbe1efd925181c7 /gnu/system/uuid.scm
parent67a08f1809c5a67dfb862ccdc3dc4e13ae35dcbf (diff)
downloadpatches-aed1f1b049f6e7ef9f2f2db58bdca6cd3effe94b.tar
patches-aed1f1b049f6e7ef9f2f2db58bdca6cd3effe94b.tar.gz
uuid: Add 'uuid=?' and use it.
* gnu/system/uuid.scm (uuid=?): New procedure. * tests/uuid.scm ("uuid=?"): New test. * gnu/build/file-systems.scm (partition-uuid-predicate) (luks-partition-uuid-predicate): Use it instead of 'bytevector=?'.
Diffstat (limited to 'gnu/system/uuid.scm')
-rw-r--r--gnu/system/uuid.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm
index 6470abb8cc..e422e06a6d 100644
--- a/gnu/system/uuid.scm
+++ b/gnu/system/uuid.scm
@@ -29,6 +29,7 @@
uuid?
uuid-type
uuid-bytevector
+ uuid=?
bytevector->uuid
@@ -281,3 +282,15 @@ corresponding bytevector; otherwise return #f."
((_ . (? procedure? unparse)) (unparse bv))))
(((? uuid? uuid))
(uuid->string (uuid-bytevector uuid) (uuid-type uuid)))))
+
+(define uuid=?
+ ;; Return true if A is equal to B, comparing only the actual bits.
+ (match-lambda*
+ (((? bytevector? a) (? bytevector? b))
+ (bytevector=? a b))
+ (((? uuid? a) (? bytevector? b))
+ (bytevector=? (uuid-bytevector a) b))
+ (((? uuid? a) (? uuid? b))
+ (bytevector=? (uuid-bytevector a) (uuid-bytevector b)))
+ ((a b)
+ (uuid=? b a))))