Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c

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

 



In message <20071028141222.GA29323@xxxxxxxxxxxxx>, Christoph Hellwig writes:
> Nice, I always hated these double-indented switch statements.
> 
> > +	case FIBMAP:
> > +	{
> > +		struct address_space *mapping = filp->f_mapping;
> > +		int res;
> > +		/* do we support this mess? */
> > +		if (!mapping->a_ops->bmap)
> > +			return -EINVAL;
> > +		if (!capable(CAP_SYS_RAWIO))
> > +			return -EPERM;
> > +		error = get_user(block, p);
> > +		if (error)
> > +			return error;
> > +		lock_kernel();
> > +		res = mapping->a_ops->bmap(mapping, block);
> > +		unlock_kernel();
> > +		return put_user(res, p);
> 
> While you're at it, it's probably worth splitting this out into
> a small helper function.

Sure.  I assume you mean an internal function to encapsulate the entire case
statement's code, one for each of the FIO* cases.

Erez.
-
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