From 7f8ad82bf23b032ad6bd85bb1daa87cc83de509c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 2 Aug 2016 12:27:57 +0200 Subject: mapped-devices: Make RAID device opening message clearer. * gnu/system/mapped-devices.scm (open-raid-device): Rename 'source' to 'sources'. Make 'waiting' message more informative. (close-raid-device): Rename 'source' to 'sources'. --- gnu/system/mapped-devices.scm | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 1cfd649278..2a0706e50b 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -128,20 +128,24 @@ (open open-luks-device) (close close-luks-device))) -(define (open-raid-device source target) - "Return a gexp that assembles SOURCE (a list of devices) to the RAID device -TARGET, using 'mdadm'." - #~(let ((every (@ (srfi srfi-1) every))) - (let loop () - (unless (every file-exists? '#$source) - (format #t "waiting a bit...~%") - (sleep 1) - (loop))) - (zero? (system* (string-append #$mdadm "/sbin/mdadm") - "--assemble" #$target - #$@source)))) - -(define (close-raid-device source target) +(define (open-raid-device sources target) + "Return a gexp that assembles SOURCES (a list of devices) to the RAID device +TARGET (e.g., \"/dev/md0\"), using 'mdadm'." + #~(begin + (use-modules (srfi srfi-1) (ice-9 format)) + + (let ((sources '#$sources)) + (let loop () + (unless (every file-exists? sources) + (format #t "waiting for RAID source devices~{ ~a~}...~%" + sources) + (sleep 1) + (loop))) + + (zero? (system* (string-append #$mdadm "/sbin/mdadm") + "--assemble" #$target sources))))) + +(define (close-raid-device sources target) "Return a gexp that stops the RAID device TARGET." #~(zero? (system* (string-append #$mdadm "/sbin/mdadm") "--stop" #$target))) -- cgit v1.2.3