aboutsummaryrefslogtreecommitdiff
path: root/src/property/disk.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-13 21:44:08 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-13 21:44:08 -0700
commit5bbb649fb5f54eb44e6f418ec7905ba9a2a9fb45 (patch)
treecc0f133b7a3112d6c739fc48486d6c8f2921c82d /src/property/disk.lisp
parentf5e5206dd3c98076ac58e912285c9ba4dacd3bb6 (diff)
downloadconsfigurator-5bbb649fb5f54eb44e6f418ec7905ba9a2a9fb45.tar.gz
WITH-OPEN-VOLUMES: add :OPENED-VOLUMES argument
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/disk.lisp')
-rw-r--r--src/property/disk.lisp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/property/disk.lisp b/src/property/disk.lisp
index aaa48c5..80a11eb 100644
--- a/src/property/disk.lisp
+++ b/src/property/disk.lisp
@@ -423,14 +423,23 @@ specify \"luks1\" if this is needed.")))
;;;; Recursive operations
-(defmacro with-open-volumes
- ((volumes &key (mount-below nil mount-below-supplied-p)) &body forms)
+(defmacro with-open-volumes ((volumes
+ &key
+ (mount-below nil mount-below-supplied-p)
+ opened-volumes)
+ &body forms)
"Where each of VOLUMES is a VOLUME which may be opened by calling OPEN-VOLUME
with NIL as the second argument, recursively open each of VOLUMES and any
contents thereof, execute forms, and close all volumes that were opened.
+
MOUNT-BELOW specifies the pathname to be prefixed to mount points when opening
-FILESYSTEM volumes."
- (with-gensyms (opened-volumes)
+FILESYSTEM volumes. OPENED-VOLUMES specifies a symbol to which a list of all
+volumes which were opened will be bound, which can be used to do things like
+populate /etc/fstab and /etc/crypttab. Do not modify the list bound to
+OPENED-VOLUMES."
+ (let ((opened-volumes (or opened-volumes (gensym "OPENED-VOLUMES")))
+ (opened (gensym "OPENED"))
+ (opened-contents (gensym "OPENED-CONTENTS")))
(once-only (mount-below)
(flet ((mount-below (form)
(if mount-below-supplied-p
@@ -441,13 +450,13 @@ FILESYSTEM volumes."
(progn
(labels
((open-volume-and-contents (volume file)
- (multiple-value-bind (opened opened-contents)
+ (multiple-value-bind (,opened ,opened-contents)
,(mount-below '(open-volume volume file))
(setq ,opened-volumes
- (append opened-contents
- (cons opened ,opened-volumes)))
+ (append ,opened-contents
+ (cons ,opened ,opened-volumes)))
(dolist (opened-volume
- (or opened-contents (list opened)))
+ (or ,opened-contents (list ,opened)))
(when (slot-boundp opened-volume 'volume-contents)
(open-volume-and-contents
(volume-contents opened-volume)