summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-17 18:26:50 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-18 01:24:06 +0200
commit4da8c19e8337cbb908d5e77cd912791846070fb7 (patch)
tree81786e610cba74823f345707a6c48ddfb719fa83 /gnu/system
parent1ea507bce294d12223c35c3f8c2ae3e54a4127fd (diff)
downloadguix-4da8c19e8337cbb908d5e77cd912791846070fb7.tar.gz
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.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/mapped-devices.scm16
1 files changed, 7 insertions, 9 deletions
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index be2d6a4749..2706e255c5 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
-@code{\"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))
 
 
 ;;;