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:
Eryu Guan
2014-05-13 09:05:43 +10:00
committed by Dave Chinner
parent 9f3515572c
commit ec08236ff7
6 changed files with 21 additions and 7 deletions
+1 -3
View File
@@ -41,9 +41,7 @@ _need_to_be_root
_require_scratch
_require_fail_make_request
# TODO: Function are common enough to be moved to common/blkdev
SCRATCH_REAL_DEV=`readlink -f $SCRATCH_DEV`
SCRATCH_BDEV=`basename $SCRATCH_REAL_DEV`
SCRATCH_BDEV=`_short_dev $SCRATCH_DEV`
allow_fail_make_request()
{