Re: [PATCH blktests 2/9] common: add a helper if a driver is available

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

 



On May 30, 2022 / 15:08, Christoph Hellwig wrote:
> Unlike _have_modules this allows allows for a built-in driver.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  common/rc | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 5e35e21..a93b227 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -28,6 +28,18 @@ _have_root() {
>  	return 0
>  }
>  
> +_have_driver()
> +{
> +	local modname="${1/-/_}"
> +
> +	if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q ${modname}; then

Nit: double quote is required for ${modname} to make shellcheck happy.

Other than that, looks good to me.

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>

-- 
Shin'ichiro Kawasaki



[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