common: Introduce get_block_size() helper

Currently many tests and other functions uses it's own way to get block
size of the file system. Introduce get_block_size(), a generic way to
get block size of mounted file system and use that instead.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Lukas Czerner
2014-10-14 17:07:52 +11:00
committed by Dave Chinner
parent 48c45430ce
commit a2a1fc679e
7 changed files with 16 additions and 7 deletions
+9
View File
@@ -2542,6 +2542,15 @@ _short_dev()
echo `basename $(_real_dev $1)`
}
get_block_size()
{
if [ -z $1 ] || [ ! -d $1 ]; then
echo "Missing mount point argument for get_block_size"
exit 1
fi
echo `stat -f -c %S $1`
}
init_rc
################################################################################