mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: Christoph Hellwig <hch@infradead.org>
Cc: Erez Zadok <ezk@cs.sunysb.edu>,
	viro@ftp.linux.org.uk, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
Date: Sun, 28 Oct 2007 14:05:16 -0400	[thread overview]
Message-ID: <200710281805.l9SI5GoF015442@agora.fsl.cs.sunysb.edu> (raw)
In-Reply-To: Your message of "Sun, 28 Oct 2007 14:12:22 -0000." <20071028141222.GA29323@infradead.org>

In message <20071028141222.GA29323@infradead.org>, 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.

  reply	other threads:[~2007-10-28 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27 23:10 [PATCH] 0/3 fs/ioctl.c coding style, rename vfs_ioctl/do_ioctl Erez Zadok
2007-10-27 23:10 ` [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c Erez Zadok
2007-10-28 14:12   ` Christoph Hellwig
2007-10-28 18:05     ` Erez Zadok [this message]
2007-10-30  9:54       ` Christoph Hellwig
2007-10-29  2:57     ` Daniel Phillips
2007-10-30  9:55       ` Christoph Hellwig
2007-10-27 23:10 ` [PATCH 2/3] VFS: swap do_ioctl and vfs_ioctl names Erez Zadok
2007-10-28 14:14   ` Christoph Hellwig
2007-10-27 23:10 ` [PATCH 3/3] Unionfs: use vfs_ioctl Erez Zadok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710281805.l9SI5GoF015442@agora.fsl.cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®