Re: [RFC PATCHv2 2/3] nvme: introduce multipath_head_always module param

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

 



On Fri, Apr 25, 2025 at 04:03:09PM +0530, Nilay Shroff wrote:
> +static int multipath_param_set(const char *val, const struct kernel_param *kp)
> +{
> +	int ret;
> +
> +	ret = param_set_bool(val, kp);
> +	if (ret)
> +		return ret;
> +
> +	if (multipath_head_always && !*(bool *)kp->arg) {
> +		pr_err("Can't disable multipath when multipath_head_always is configured.\n");
> +		*(bool *)kp->arg = true;

This reads much nicer if you add a local bool * variable and avoid
all the casting, i.e.

	bool *arg = kp->arg;

	...

	if (multipath_head_always && !*kp->arg) {
		pr_err("Can't disable multipath when multipath_head_always is configured.\n");
		*arg = true;

> +static int multipath_head_always_set(const char *val,
> +		const struct kernel_param *kp)
> +{
> +	int ret;
> +
> +	ret = param_set_bool(val, kp);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (*(bool *)kp->arg)
> +		multipath = true;

Same here.





[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