diff options
author | Marius Bakke <mbakke@fastmail.com> | 2017-09-24 19:18:35 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2017-09-24 19:18:35 +0200 |
commit | ffcff272728e750c62acbbf8322c2ad35d69ad81 (patch) | |
tree | bdab0ab0d8e0ede962fcd0f9a5474f67bb9ed682 /gnu/system/uuid.scm | |
parent | 6baf1b72057ccda6e491596ad3715c4f555e6a69 (diff) | |
parent | 030030f4416b54285dcdd58bddb863c0e6bda4c4 (diff) | |
download | guix-ffcff272728e750c62acbbf8322c2ad35d69ad81.tar guix-ffcff272728e750c62acbbf8322c2ad35d69ad81.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'gnu/system/uuid.scm')
-rw-r--r-- | gnu/system/uuid.scm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm index 1dd6a11339..6470abb8cc 100644 --- a/gnu/system/uuid.scm +++ b/gnu/system/uuid.scm @@ -41,6 +41,7 @@ string->ext3-uuid string->ext4-uuid string->btrfs-uuid + string->fat32-uuid iso9660-uuid->string ;; XXX: For lack of a better place. @@ -175,6 +176,22 @@ ISO9660 UUID representation." (low (bytevector-uint-ref uuid 2 %fat32-endianness 2))) (format #f "~:@(~x-~x~)" low high))) +(define %fat32-uuid-rx + (make-regexp "^([[:xdigit:]]{4})-([[:xdigit:]]{4})$")) + +(define (string->fat32-uuid str) + "Parse STR, which is in FAT32 format, and return a bytevector or #f." + (match (regexp-exec %fat32-uuid-rx str) + (#f + #f) + (rx-match + (uint-list->bytevector (list (string->number + (match:substring rx-match 2) 16) + (string->number + (match:substring rx-match 1) 16)) + %fat32-endianness + 2)))) + ;;; ;;; Generic interface. @@ -198,6 +215,7 @@ ISO9660 UUID representation." (define %uuid-parsers (vhashq ('dce 'ext2 'ext3 'ext4 'btrfs 'luks => string->dce-uuid) + ('fat32 'fat => string->fat32-uuid) ('iso9660 => string->iso9660-uuid))) (define %uuid-printers |