mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/rc: introduce _overlay_mount_dirs helper
Introduce a new _overlay_mount_dirs() helper to do the actual overlay mount operation and factor _overlay_scratch_mount and _overlay_mount code to use a single implemention of _overlay_mount_dirs(). Also convert all bare mount of overlay in tests to use it. Suggested-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
@@ -266,6 +266,18 @@ _scratch_mount_options()
|
||||
$SCRATCH_DEV $SCRATCH_MNT
|
||||
}
|
||||
|
||||
# helper function to do the actual overlayfs mount operation
|
||||
_overlay_mount_dirs()
|
||||
{
|
||||
local lowerdir=$1
|
||||
local upperdir=$2
|
||||
local workdir=$3
|
||||
shift 3
|
||||
|
||||
$MOUNT_PROG -t overlay -o lowerdir=$lowerdir -o upperdir=$upperdir \
|
||||
-o workdir=$workdir $*
|
||||
}
|
||||
|
||||
# Given a dir, set up 3 subdirectories and mount on the given mnt.
|
||||
# The dir is used as the mount device so it can be seen from df or mount
|
||||
_overlay_mount()
|
||||
@@ -293,12 +305,9 @@ _overlay_mount()
|
||||
mkdir -p $dir/$OVERLAY_LOWER_DIR
|
||||
mkdir -p $dir/$OVERLAY_WORK_DIR
|
||||
|
||||
$MOUNT_PROG -t overlay $SELINUX_MOUNT_OPTIONS \
|
||||
-o lowerdir=$dir/$OVERLAY_LOWER_DIR \
|
||||
-o upperdir=$dir/$OVERLAY_UPPER_DIR \
|
||||
-o workdir=$dir/$OVERLAY_WORK_DIR \
|
||||
$OVERLAY_MOUNT_OPTIONS $* \
|
||||
$dir $mnt
|
||||
_overlay_mount_dirs $dir/$OVERLAY_LOWER_DIR $dir/$OVERLAY_UPPER_DIR \
|
||||
$dir/$OVERLAY_WORK_DIR $OVERLAY_MOUNT_OPTIONS \
|
||||
$SELINUX_MOUNT_OPTIONS $* $dir $mnt
|
||||
}
|
||||
|
||||
_overlay_test_mount()
|
||||
|
||||
Reference in New Issue
Block a user