aboutsummaryrefslogtreecommitdiffstats
path: root/block/ioctl.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2007-10-09 07:23:51 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:26:00 -0400
commitf58c4c0a17e500e767473598b3deafaa1d64051d (patch)
treef8fbf3a2ce10a9fccf41f2f96bca1ca71b3dd77e /block/ioctl.c
parentd2bbf3da3759d04cd5836955cc59c8ae96092831 (diff)
compat_ioctl: move common block ioctls to compat_blkdev_ioctl
Make compat_blkdev_ioctl and blkdev_ioctl reflect the respective native versions. This is somewhat more efficient and makes it easier to keep the two in sync. Also get rid of the bogus handling for broken_blkgetsize and the duplicate entry for BLKRASET. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index f7e3e8abf887..52d6385216ad 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -217,6 +217,10 @@ int blkdev_driver_ioctl(struct inode *inode, struct file *file,
217} 217}
218EXPORT_SYMBOL_GPL(blkdev_driver_ioctl); 218EXPORT_SYMBOL_GPL(blkdev_driver_ioctl);
219 219
220/*
221 * always keep this in sync with compat_blkdev_ioctl() and
222 * compat_blkdev_locked_ioctl()
223 */
220int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, 224int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
221 unsigned long arg) 225 unsigned long arg)
222{ 226{
@@ -284,21 +288,4 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
284 288
285 return blkdev_driver_ioctl(inode, file, disk, cmd, arg); 289 return blkdev_driver_ioctl(inode, file, disk, cmd, arg);
286} 290}
287
288/* Most of the generic ioctls are handled in the normal fallback path.
289 This assumes the blkdev's low level compat_ioctl always returns
290 ENOIOCTLCMD for unknown ioctls. */
291long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
292{
293 struct block_device *bdev = file->f_path.dentry->d_inode->i_bdev;
294 struct gendisk *disk = bdev->bd_disk;
295 int ret = -ENOIOCTLCMD;
296 if (disk->fops->compat_ioctl) {
297 lock_kernel();
298 ret = disk->fops->compat_ioctl(file, cmd, arg);
299 unlock_kernel();
300 }
301 return ret;
302}
303
304EXPORT_SYMBOL_GPL(blkdev_ioctl); 291EXPORT_SYMBOL_GPL(blkdev_ioctl);