Commit Graph

8 Commits

Author SHA1 Message Date
Ludovic Courtès 263c9941a1
uuid: 'uuid' returns #f when 'string->uuid' returns #f.
* gnu/system/uuid.scm (uuid): When STR is not a literal, return #f when
'string->uuid' returns #f.
* tests/uuid.scm ("uuid, dynamic value"): New test.
2018-05-19 00:14:52 +02:00
Ludovic Courtès bf57e1c708
uuid: Fix typo in comment.
* gnu/system/uuid.scm: Fix typo in comment.
2017-12-02 23:13:20 +01:00
Ludovic Courtès 03f66aea63
uuid: Change "fat32" to "fat".
* gnu/system/uuid.scm (%fat32-endianness): Rename to...
(%fat-endianness): ... this.
(fat32-uuid->string): Rename to...
(fat-uuid->string): ... this.
(%fat32-uuid-rx): Rename to..
(%fat-uuid-rx): ... this.
(string->fat32-uuid): Rename to...
(string->fat-uuid): ... this.
(%uuid-parsers, %uuid-printers): Add 'fat16.
2017-10-11 11:12:33 +02:00
Ludovic Courtès aed1f1b049
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=?'.
2017-10-05 12:09:17 +02:00
Ludovic Courtès 8a7d81a5e2
uuid: Add a parser for FAT32 UUIDs.
* gnu/system/uuid.scm (%fat32-uuid-rx): New variable.
(string->fat32-uuid): New procedure.
(%uuid-parsers): Add it.
* tests/uuid.scm ("uuid, FAT32, format preserved"): New test.
2017-09-22 18:40:57 +02:00
Ludovic Courtès ce094b4663
uuid: 'uuid' macro supports more UUID types.
* gnu/system/uuid.scm (string->uuid): Turn 'type' into an optional
argument.
(uuid): Add clauses to allow for an optional 'type' parameter.
2017-09-11 22:24:47 +02:00
Ludovic Courtès 9b336338cd
system: Introduce a disjoint UUID type.
Conceptually a UUID is just a bytevector.  However, there's software out
there such as GRUB that relies on the string representation of different
UUID types (e.g., the string representation of DCE UUIDs differs from
that of ISO-9660 UUIDs, even if they are actually bytevectors of the
same length).  This new <uuid> record type allows us to preserve
information about the type of UUID so we can eventually convert it to a
string using the right representation.

* gnu/system/uuid.scm (<uuid>): New record type.
(bytevector->uuid): New procedure.
(uuid): Return calls to 'make-uuid'.
(uuid->string): Rewrite using 'match-lambda*' to accept a single 'uuid?'
argument.
* gnu/bootloader/grub.scm (grub-root-search): Check for 'uuid?' instead
of 'bytevector?'.
* gnu/system.scm (bootable-kernel-arguments): Check whether ROOT-DEVICE
is 'uuid?'.
(read-boot-parameters): Use 'bytevector->uuid' when the
store device is a bytevector.
(read-boot-parameters-file): Check for 'uuid?' instead of 'bytevector?'.
(device->sexp): New procedure.
(operating-system-boot-parameters-file): Use it for 'root-device' and
'store'.
(operating-system-bootcfg): Remove conditional in definition of
'root-device'.
* gnu/system/file-systems.scm (file-system->spec): Check for 'uuid?' on
DEVICE and take its bytevector.
* gnu/system/mapped-devices.scm (open-luks-device): Likewise.
* gnu/system/vm.scm (iso9660-image): Call 'uuid-bytevector' for the
 #:volume-uuid argument.
2017-09-11 22:24:46 +02:00
Ludovic Courtès 47cef4ecad
file-systems: Introduce (gnu system uuid).
* gnu/build/file-systems.scm (sub-bytevector)
(latin1->string, %fat32-endianness, fat32-uuid->string)
(%iso9660-uuid-rx, string->iso9660-uuid)
(iso9660-uuid->string, %network-byte-order)
(dce-uuid->string, %uuid-rx, string->dce-uuid)
(string->ext2-uuid, string->ext3-uuid, string->ext4-uuid)
(vhashq, %uuid-parsers, %uuid-printers, string->uuid)
(uuid->string): Move to...
* gnu/system/uuid.scm: ... here.  New file.
* gnu/system/file-systems.scm (uuid): Move to the above file.
* gnu/system/vm.scm: Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add uuid.scm.
2017-09-11 22:24:46 +02:00