[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200710281805.l9SI5GoF015442@agora.fsl.cs.sunysb.edu>
Date: Sun, 28 Oct 2007 14:05:16 -0400
From: Erez Zadok <ezk@...sunysb.edu>
To: Christoph Hellwig <hch@...radead.org>
Cc: Erez Zadok <ezk@...sunysb.edu>, viro@....linux.org.uk,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
In message <20071028141222.GA29323@...radead.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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists