lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240623121103.974270-3-hch@lst.de>
Date: Sun, 23 Jun 2024 14:10:31 +0200
From: Christoph Hellwig <hch@....de>
To: Zorro Lang <zlang@...nel.org>
Cc: fstests@...r.kernel.org,
	"Theodore Ts'o" <tytso@....edu>,
	linux-ext4@...r.kernel.org
Subject: [PATCH 2/8] generic/740: clean up handling of mkfs options

Use a single case statement instead of lots of conditionals.

Signed-off-by: Christoph Hellwig <hch@....de>
---
 tests/generic/740 | 50 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/tests/generic/740 b/tests/generic/740
index 3deba86b3..fc2ec627f 100755
--- a/tests/generic/740
+++ b/tests/generic/740
@@ -29,27 +29,41 @@ fi
 echo "Silence is golden."
 for fs in `echo ${MKFS_PROG}.* | sed -e "s:${MKFS_PROG}.::g"`
 do
-	preop=""	# for special input needs
+	preop=""	# for special input needs (usually a prompt)
 	preargs=""	# for any special pre-device options
 	postargs=""	# for any special post-device options
 
-	# minix, msdos and vfat mkfs fails for large devices, restrict to 2000 blocks
-	[ $fs = minix ] && postargs=2000
-	[ $fs = msdos ] && postargs=2000
-	[ $fs = vfat ] && postargs=2000
-	# these folks prompt before writing
-	[ $fs = jfs ] && preop="echo Y |"
-	[ $fs = gfs ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
-	[ $fs = gfs2 ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
-	[ $fs = reiserfs ] && preop="echo y |" && preargs="-f"
-	[ $fs = reiser4 ] && preop="echo y |" && preargs="-f"
-	# cramfs mkfs requires a directory argument
-	[ $fs = cramfs ] && preargs=/proc/fs
-	[ $fs = ext2 ] && preargs="-F"
-	[ $fs = ext3 ] && preargs="-F"
-	[ $fs = ext4 ] && preargs="-F"
-	# jffs2 mkfs requires '-r $directory' and '-o $image'
-	[ $fs = jffs2 ] && preargs="-r /proc/fs -o"
+	case "$fs"  in
+	ext2|ext3|ext4)
+		preargs="-F"
+		;;
+	cramfs)
+		# cramfs mkfs requires a directory argument
+		preargs=/proc/fs
+		;;
+	gfs|gfs2)
+		preop="echo y |"
+		preargs="-p lock_nolock -j 1"
+		;;
+	jffs2)
+		# jffs2 mkfs requires '-r $directory' and '-o $image'
+		preargs="-r /proc/fs -o"
+		;;
+	jfs)
+		preop="echo Y |"
+		;;
+	minix|msdos|vfat)
+		# minix, msdos and vfat mkfs fails for large devices,
+		# restrict to 2000 blocks
+		postargs=2000
+		;;
+	reiserfs|reiser4)
+		preop="echo y |"
+		preargs="-f"
+		;;
+	*)
+		;;
+	esac
 
 	# overwite the first few Kb - should blow away superblocks
 	$here/src/devzero -n 20 $SCRATCH_DEV >/dev/null
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ