tst_mkfs: drop -f from mkfs
PATCH 1/2 tst_mkfs: drop -f from mkfs
We no longer need to pass the force flag to mkfs due to
commit f79021c5d168 ("tst_acquire_device: clear first sectors of LTP_DEV").
Signed-off-by Stanislav Kholmanskikh <[email protected]>
---
This patch is a follow up to:
http://lists.linux.it/pipermail/ltp/2016-February/001044.html
lib/tst_mkfs.c | 21 ---------------------
testcases/lib/test.sh | 21 ++------------------- 2 files changed, 2 insertions(+), 40 deletions(-)
lib/tst_mkfs.c +0 -21
@@ -31,27 +31,6 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,if (!fs_type)tst_brkm (TBROK , cleanup_fn,"No fs_type specified" ); -/* -* mkfs.xfs and mkfs.btrfs aborts if it finds a filesystem -* superblock on the device, which is the case here as we -* reuse one device for all tests. -*/ -if (!strcmp (fs_type,"xfs" )) { -tst_resm (TINFO ,"Appending '-f' flag to mkfs.%s" , fs_type); - argv[pos++] ="-f" ; - } - -if (!strcmp (fs_type,"btrfs" )) { -/* -* The -f option was added to btrfs-progs v3.12 -*/ -if (!tst_system ("mkfs.btrfs 2>&1 | grep -q '\\-f[ |]'" )) { -tst_resm (TINFO ,"Appending '-f' flag to mkfs.%s" , - fs_type); - argv[pos++] ="-f" ; - } - } -if (fs_opts) {for (i =0 ; fs_opts[i]; i++) { argv[pos++] = fs_opts[i];
testcases/lib/test.sh +2 -19
@@ -300,26 +300,9 @@ tst_mkfs() { local fs_type=$1 local device=$2 - local fs_opts="" - - if [ $fs_type = "xfs" -o $fs_type = "jfs" ]; then - tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type" - fs_opts="-f" - fi - - if [ $fs_type = "btrfs" ]; then - # check if mkfs.btrfs supports -f option - # detect "-f --force" or "-f|--force" because btrfs-progs - # changes usage text in commit 3f312d500b73 - mkfs.btrfs 2>&1 | grep -q '\-f[ |]' >/dev/null - if [ $? -eq 0 ]; then - tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type" - fs_opts="-f" - fi - fi - shift 2 - fs_opts="$fs_opts $@" + local fs_opts="$@" + tst_resm TINFO "Formatting $device with $fs_type extra opts='$fs_opts'" ROD_SILENT mkfs.$fs_type $fs_opts $device
Signature · 1 line
1.7.1
PATCH 2/2 tst_mkfs: check the arguments for passed device and fs_type
Signed-off-by Stanislav Kholmanskikh <[email protected]>
--- lib/tst_mkfs.c | 3 +++ testcases/lib/test.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
lib/tst_mkfs.c +3 -0
@@ -28,6 +28,9 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,const char *argv[OPTS_MAX ] = {"mkfs" ,"-t" , fs_type};char fs_opts_str[1024 ] ="" ; +if (!dev) +tst_brkm (TBROK , cleanup_fn,"No device specified" ); +if (!fs_type)tst_brkm (TBROK , cleanup_fn,"No fs_type specified" );
testcases/lib/test.sh +8 -0
@@ -303,6 +303,14 @@ tst_mkfs() shift 2 local fs_opts="$@" + if [ -z "$fs_type" ]; then + tst_brkm TBROK "No fs_type specified" + fi + + if [ -z "$device" ]; then + tst_brkm TBROK "No device specified" + fi + tst_resm TINFO "Formatting $device with $fs_type extra opts='$fs_opts'" ROD_SILENT mkfs.$fs_type $fs_opts $device
Signature · 1 line
1.7.1
PATCH 2/2 tst_mkfs: check the arguments for passed device and fs_type
Hi!
Both patches acked.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/2 tst_mkfs: check the arguments for passed device and fs_type
Quoted 3 lines · Cyril Hrubis
Hi!
Both patches acked.
Thank you. Pushed.