From 722554a306be645026d75893b77863769dcd861d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 18 Sep 2014 19:18:39 +0200 Subject: system: Define 'device-mapping-kind', and add a 'close' procedure. * gnu/system/file-systems.scm (): New record type. ()[command]: Remove field. [type]: New field. * gnu/services/base.scm (device-mapping-service): Rename 'command' parameter to 'open'. Add 'close' parameter and honor it. * gnu/system.scm (luks-device-mapping): Rename to... (open-luks-device): ... this. (close-luks-device): New procedure. (luks-device-mapping): New variable. (device-mapping-services): Get the type of MD, and pass its 'open' and 'close' fields to 'device-mapping-service'. --- gnu/services/base.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index bfe5f52af4..f2de85f410 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -600,19 +600,18 @@ extra rules from the packages listed in @var{rules}." ;; called. Thus, make sure it is not respawned. (respawn? #f))))) -(define (device-mapping-service target command) +(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}), by executing @var{command}, -a gexp." +@code{\"home\"} (meaning @code{/dev/mapper/home}). Evaluate @var{open}, a +gexp, to open it, and evaluate @var{close} to close it." (with-monad %store-monad (return (service (provision (list (symbol-append 'device-mapping- (string->symbol target)))) (requirement '(udev)) (documentation "Map a device node using Linux's device mapper.") - (start #~(lambda () - #$command)) - (stop #~(const #f)) + (start #~(lambda () #$open)) + (stop #~(lambda _ (not #$close))) (respawn? #f))))) (define %base-services -- cgit 1.4.1