Move FIBMAP logic out of file_ioctl() in preparation for introducing FIBMAP64.
Signed-off-by: Mike Waychison <mikew@google.com>
fs/ioctl.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
Index: linux-2.6.23/fs/ioctl.c
===================================================================
--- linux-2.6.23.orig/fs/ioctl.c 2007-10-26 15:26:11.000000000 -0700
+++ linux-2.6.23/fs/ioctl.c 2007-10-26 16:16:28.000000000 -0700
@@ -40,6 +40,21 @@ static long do_ioctl(struct file *filp,
return error;
}
+static int do_fibmap(struct address_space *mapping, sector_t block,
+ sector_t *phys_block)
+{
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ if (!mapping->a_ops->bmap)
+ return -EINVAL;
+
+ lock_kernel();
+ *phys_block = mapping->a_ops->bmap(mapping, block);
+ unlock_kernel();
+
+ return 0;
+}
+
static int file_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -55,18 +70,14 @@ static int file_ioctl(struct file *filp,
sector_t phys_block;
int res;
/* do we support this mess? */
- if (!mapping->a_ops->bmap)
- return -EINVAL;
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
if ((error = get_user(block, p)) != 0)
return error;
if (block < 0)
return -EINVAL;
- lock_kernel();
- phys_block = mapping->a_ops->bmap(mapping, block);
- unlock_kernel();
+ error = do_fibmap(mapping, block, &phys_block);
+ if (error)
+ return error;
/* Make sure that the return value fits in the
* user's buffer. */
--
-
| Greg Kroah-Hartman | [PATCH 008/196] Chinese: add translation of volatile-considered-harmful.txt |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | Re: [Patch v2] Make PCI extended config space (MMCONFIG) a driver opt-in |
| Andrew Morton | -mm merge plans for 2.6.23 |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Herbert Xu | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Rémi Denis-Courmont | [PATCH 01/14] Phonet global definitions |
