[PATCH blktests 5/9] common: do not require null_blk support to be modular

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use _have_driver instead of _have_modules in _have_null_blk for the basic
null_blk check, and instead only require an actual module in
_init_null_blk when specific module parameters are passed.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 common/null_blk | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/common/null_blk b/common/null_blk
index 6611db0..ccf3750 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -5,7 +5,7 @@
 # null_blk helper functions.
 
 _have_null_blk() {
-	_have_modules null_blk
+	_have_driver null_blk
 }
 
 _remove_null_blk_devices() {
@@ -16,15 +16,19 @@ _remove_null_blk_devices() {
 }
 
 _init_null_blk() {
-	_remove_null_blk_devices
+	local modparams="$@"
 
-	local zoned=""
-	if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi
+	if (( RUN_FOR_ZONED )); then
+		modparams="${modparams} zoned=1"
+	fi
 
-	if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then
+	if [ -n "${modparams}" ] && ! _have_modules null_blk; then
 		return 1
 	fi
 
+	_remove_null_blk_devices
+	modprobe -qr null_blk && modprobe -q null_blk ${modparams}
+
 	udevadm settle
 	return 0
 }
@@ -46,5 +50,5 @@ _configure_null_blk() {
 _exit_null_blk() {
 	_remove_null_blk_devices
 	udevadm settle
-	modprobe -r null_blk
+	modprobe -qr null_blk
 }
-- 
2.30.2




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux