summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2023-12-06 14:18:57 +0200
committerZorro Lang <zlang@kernel.org>2024-01-14 20:39:09 +0800
commita5c3a12796cf965ccd5b87d4cff653c4350076ae (patch)
treebe4d30ed7eb7e2af6c66b9e8eaac7aaf3f02fe35 /common
parent4fd042e0465c97ba84b244ca1018698f44bbf1db (diff)
overlay: create helper _overlay_scratch_mount_opts()
The new overlayfs mount options lowerdir+,datadir+ don't fit well into any of the existing _overlay_scratch_mount* helpers. Add this new helper to reduce a common pattern of custom mount options. Suggested-by: Zorro Lang <zlang@kernel.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r--common/overlay8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/overlay b/common/overlay
index ea1eb7b1..faa9339a 100644
--- a/common/overlay
+++ b/common/overlay
@@ -32,6 +32,12 @@ _overlay_mount_dirs()
$MOUNT_PROG -t overlay $diropts `_common_dev_mount_options $*`
}
+# Mount with mnt/dev of scratch mount and custom mount options
+_overlay_scratch_mount_opts()
+{
+ $MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT $*
+}
+
# Mount with same options/mnt/dev of scratch mount, but optionally
# with different lower/upper/work dirs
_overlay_scratch_mount_dirs()
@@ -254,7 +260,7 @@ _require_scratch_overlay_lowerdir_add_layers()
local datadir="$OVL_BASE_SCRATCH_MNT/$OVL_LOWER"
_scratch_mkfs > /dev/null 2>&1
- $MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \
+ _overlay_scratch_mount_opts \
-o"lowerdir+=$lowerdir,datadir+=$datadir" \
-o"redirect_dir=follow,metacopy=on" > /dev/null 2>&1 || \
_notrun "overlay lowerdir+,datadir+ not supported on ${SCRATCH_DEV}"