[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: mapped-devices: 'mapped-device-service' takes a <mapped-device>.
From: |
Ludovic Courtès |
Subject: |
04/05: mapped-devices: 'mapped-device-service' takes a <mapped-device>. |
Date: |
Sun, 17 Apr 2016 23:24:14 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 4da8c19e8337cbb908d5e77cd912791846070fb7
Author: Ludovic Courtès <address@hidden>
Date: Sun Apr 17 18:26:50 2016 +0200
mapped-devices: 'mapped-device-service' takes a <mapped-device>.
* gnu/system/mapped-devices.scm (device-mapping-service): Take a
<mapped-device> instead of 3 parameters.
(device-mapping-service-type): Adjust accordingly.
* gnu/system.scm (device-mapping-services): Adjust accordingly.
---
gnu/system.scm | 10 +---------
gnu/system/mapped-devices.scm | 16 +++++++---------
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/gnu/system.scm b/gnu/system.scm
index b1454b2..768ca9c 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -233,15 +233,7 @@ from the initrd."
(define (device-mapping-services os)
"Return the list of device-mapping services for OS as a list."
- (map (lambda (md)
- (let* ((source (mapped-device-source md))
- (target (mapped-device-target md))
- (type (mapped-device-type md))
- (open (mapped-device-kind-open type))
- (close (mapped-device-kind-close type)))
- (device-mapping-service target
- (open source target)
- (close source target))))
+ (map device-mapping-service
(operating-system-user-mapped-devices os)))
(define (swap-services os)
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index be2d6a4..2706e25 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -69,21 +69,19 @@
(shepherd-service-type
'device-mapping
(match-lambda
- ((target open close)
+ (($ <mapped-device> source target
+ ($ <mapped-device-type> open close))
(shepherd-service
(provision (list (symbol-append 'device-mapping- (string->symbol
target))))
(requirement '(udev))
(documentation "Map a device node using Linux's device mapper.")
- (start #~(lambda () #$open))
- (stop #~(lambda _ (not #$close)))
+ (start #~(lambda () #$(open source target)))
+ (stop #~(lambda _ (not #$(close source target))))
(respawn? #f))))))
-(define (device-mapping-service target open close)
- "Return a service that maps device @var{target}, a string such as
address@hidden"home\"} (meaning @code{/dev/mapper/home}). Evaluate @var{open},
a
-gexp, to open it, and evaluate @var{close} to close it."
- (service device-mapping-service-type
- (list target open close)))
+(define (device-mapping-service mapped-device)
+ "Return a service that sets up @var{mapped-device}."
+ (service device-mapping-service-type mapped-device))
;;;