Re: [PATCH 2/14] locks: factor out generic/filesystem switch from test_lock

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

 



> +int vfs_test_lock(struct file *filp, struct file_lock *fl, struct file_lock *conf)

Please make sure to add linebreaks after at most 80 characters.

> +	error = vfs_test_lock(filp, &file_lock, &cfl);
> +	if (error)
> +		goto out;

> +	fl = (cfl.fl_type == F_UNLCK ? NULL : &cfl);
>  	flock.l_type = F_UNLCK;
>  	if (fl != NULL) {

This code snippled is more than ugly.  fl is only checked for equality
once so you should reformulate that check using the actual type check:

	if (cfl.fl_type != F_UNLCK) {

That also allows you to move the

	flock.l_type = fl->fl_type;

out of the if statement later on.  In fact that copying out should
proably move into posix_lock_to_flock and posix_lock_to_fock64
helpers similar to the flock_to_posix_lock and flock64_to_posix_lock
helpers we have for the other way around.

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux