Re: [PATCH v4 06/40] fs: add mount_setattr()

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

 



> +	switch (attr->propagation) {
> +	case 0:
> +		kattr->propagation = 0;
> +		break;
> +	case MS_UNBINDABLE:
> +		kattr->propagation = MS_UNBINDABLE;
> +		break;
> +	case MS_PRIVATE:
> +		kattr->propagation = MS_PRIVATE;
> +		break;
> +	case MS_SLAVE:
> +		kattr->propagation = MS_SLAVE;
> +		break;
> +	case MS_SHARED:
> +		kattr->propagation = MS_SHARED;
> +		break;
> +	default:
> +		return -EINVAL;
> +	}

This can be shortened to:

#define MOUNT_SETATTR_PROPAGATION_FLAGS \
	(MS_UNBINDABLE | MS_PRIVATE | MS_SLAVE | MS_SHARED)

	if (attr->propagation & ~MOUNT_SETATTR_PROPAGATION_FLAGS)
		return -EINVAL;
	if (hweight32(attr->propagation & MOUNT_SETATTR_PROPAGATION_FLAGS) > 1)
		return -EINVAL;
	kattr->propagation = attr->propagation;

> +asmlinkage long sys_mount_setattr(int dfd, const char __user *path, unsigned int flags,

Overly long line.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux