diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 0c154d1c4e..3d09e8220c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -408,7 +408,10 @@ FILE-SYSTEM."
(define (mapped-device->shepherd-service-name md)
"Return the symbol that denotes the shepherd service of MD, a
<mapped-device>."
(symbol-append 'device-mapping-
- (string->symbol (mapped-device-target md))))
+ (string->symbol (string-join
+ (let ((t (mapped-device-target md)))
+ (if (list? t) t (list t)))
+ "-"))))
To avoid duplicating the (if (list? t) …) everywhere, I propose instead
the following approach:
1. Rename ‘target’ to ‘targets’ (plural) and likewise for the
accessor, and agree that it always contains a list;
2. Rename ‘mapped-device’ to ‘%mapped-device’ and add a
‘mapped-device’ backward-compatibility macro that allows for a
‘target’ (singular) field and automatically turns its value into a
list. See the ‘origin’ macro in (guix packages) for an example of
how to do that (that macro allows users to specify ‘sha256’ instead
of ‘hash’).
3. Add a deprecated ‘mapped-device-target’ (singular) that returns the
first element returned by ‘mapped-device-targets’.