mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: new function to get real device path name and basename
If TEST_DEV or SCRATCH_DEV is symlink(mostly a lvm lv), a simple basename is not enough, symlink should be followed. This task is common enough, so introduce new helper functions and replace all readlink calls in ext4/305 generic/009 generic/019 generic/285 generic/312 Signed-off-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
@@ -2190,6 +2190,22 @@ init_rc()
|
||||
export XFS_IO_PROG="$XFS_IO_PROG -F"
|
||||
}
|
||||
|
||||
# get real device path name by following link
|
||||
_real_dev()
|
||||
{
|
||||
local _dev=$1
|
||||
if [ -b "$_dev" ] && [ -L "$_dev" ]; then
|
||||
_dev=`readlink -f "$_dev"`
|
||||
fi
|
||||
echo $_dev
|
||||
}
|
||||
|
||||
# basename of a device
|
||||
_short_dev()
|
||||
{
|
||||
echo `basename $(_real_dev $1)`
|
||||
}
|
||||
|
||||
init_rc
|
||||
|
||||
################################################################################
|
||||
|
||||
Reference in New Issue
Block a user