login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
October
»
28
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Christoph Hellwig <hch@...>
To: Erez Zadok <ezk@...>
Cc: <hch@...>, <viro@...>, <akpm@...>, <linux-kernel@...>, <linux-fsdevel@...>
Subject:
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
Date: Sunday, October 28, 2007 - 10:12 am
Nice, I always hated these double-indented switch statements.
quoted text
> + 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.
quoted text
> + case FIONBIO: > + error = get_user(on, (int __user *)arg); > + if (error) > + break; > + flag = O_NONBLOCK; > #ifdef __sparc__ > + /* SunOS compatibility item. */ > + if (O_NONBLOCK != O_NDELAY) > + flag |= O_NDELAY; > #endif > + if (on) > + filp->f_flags |= flag; > + else > + filp->f_flags &= ~flag; > + break;
Same here.
quoted text
> + case FIOASYNC: > + error = get_user(on, (int __user *)arg); > + if (error) > break; > + flag = on ? FASYNC : 0; > + > + /* Did FASYNC state change ? */ > + if ((flag ^ filp->f_flags) & FASYNC) { > + if (filp->f_op && filp->f_op->fasync) { > + lock_kernel(); > + error = filp->f_op->fasync(fd, filp, on); > + unlock_kernel(); > + } else > error = -ENOTTY; > + } > + if (error != 0) > break; > + > + if (on) > + filp->f_flags |= FASYNC; > + else > + filp->f_flags &= ~FASYNC; > + break;
And here. -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] 0/3 fs/ioctl.c coding style, rename vfs_ioctl/do_ioctl
, Erez Zadok
, (Sat Oct 27, 7:10 pm)
[PATCH 2/3] VFS: swap do_ioctl and vfs_ioctl names
, Erez Zadok
, (Sat Oct 27, 7:10 pm)
Re: [PATCH 2/3] VFS: swap do_ioctl and vfs_ioctl names
, Christoph Hellwig
, (Sun Oct 28, 10:14 am)
[PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Erez Zadok
, (Sat Oct 27, 7:10 pm)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Christoph Hellwig
, (Sun Oct 28, 10:12 am)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Daniel Phillips
, (Sun Oct 28, 10:57 pm)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Christoph Hellwig
, (Tue Oct 30, 5:55 am)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Erez Zadok
, (Sun Oct 28, 2:05 pm)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c
, Christoph Hellwig
, (Tue Oct 30, 5:54 am)
[PATCH 3/3] Unionfs: use vfs_ioctl
, Erez Zadok
, (Sat Oct 27, 7:10 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ingo Molnar
[patch 12/13] syslets: x86: optimized copy_uatom()
Greg Kroah-Hartman
[PATCH 017/196] aoechr: Convert from class_device to device
Yinghai Lu
Re: 2.6.26, PAT and AMD family 6
Jan Engelhardt
intel iommu (Re: -mm merge plans for 2.6.23)
git
:
linux-netdev
:
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
David Miller
[GIT]: Networking
David Miller
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Natalie Protasevich
[BUG] New Kernel Bugs
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
2 users
and
675 guests
online.
Online users
strcmp
protectedtrusty
Syndicate