aboutsummaryrefslogtreecommitdiffstats
path: root/block/ioctl.c
diff options
context:
space:
mode:
authorAl Viro <al@aretha.pdmi.ras.ru>2008-09-18 03:38:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:49:08 -0400
commite436fdae70a31102d2be32969b80fe8545edebd9 (patch)
treeab07320851fc5ae82bc422ab54dbb922a8057452 /block/ioctl.c
parent572c48921574dbe6dceb958cf965aa962baefde4 (diff)
[PATCH] get rid of blkdev_driver_ioctl()
convert remaining callers to __blkdev_driver_ioctl() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 0db89f95b15f..b4e0abed1b4b 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -265,21 +265,6 @@ static int blkdev_locked_ioctl(struct file *file, struct block_device *bdev,
265 return -ENOIOCTLCMD; 265 return -ENOIOCTLCMD;
266} 266}
267 267
268int blkdev_driver_ioctl(struct inode *inode, struct file *file,
269 struct gendisk *disk, unsigned cmd, unsigned long arg)
270{
271 int ret;
272 fmode_t mode = 0;
273 if (file) {
274 mode = file->f_mode;
275 if (file->f_flags & O_NDELAY)
276 mode |= FMODE_NDELAY_NOW;
277 }
278
279 return __blkdev_driver_ioctl(inode->i_bdev, mode, cmd, arg);
280}
281EXPORT_SYMBOL_GPL(blkdev_driver_ioctl);
282
283int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, 268int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
284 unsigned cmd, unsigned long arg) 269 unsigned cmd, unsigned long arg)
285{ 270{
@@ -315,13 +300,19 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
315 struct block_device *bdev = inode->i_bdev; 300 struct block_device *bdev = inode->i_bdev;
316 struct gendisk *disk = bdev->bd_disk; 301 struct gendisk *disk = bdev->bd_disk;
317 int ret, n; 302 int ret, n;
303 fmode_t mode = 0;
304 if (file) {
305 mode = file->f_mode;
306 if (file->f_flags & O_NDELAY)
307 mode |= FMODE_NDELAY_NOW;
308 }
318 309
319 switch(cmd) { 310 switch(cmd) {
320 case BLKFLSBUF: 311 case BLKFLSBUF:
321 if (!capable(CAP_SYS_ADMIN)) 312 if (!capable(CAP_SYS_ADMIN))
322 return -EACCES; 313 return -EACCES;
323 314
324 ret = blkdev_driver_ioctl(inode, file, disk, cmd, arg); 315 ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
325 /* -EINVAL to handle old uncorrected drivers */ 316 /* -EINVAL to handle old uncorrected drivers */
326 if (ret != -EINVAL && ret != -ENOTTY) 317 if (ret != -EINVAL && ret != -ENOTTY)
327 return ret; 318 return ret;
@@ -333,7 +324,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
333 return 0; 324 return 0;
334 325
335 case BLKROSET: 326 case BLKROSET:
336 ret = blkdev_driver_ioctl(inode, file, disk, cmd, arg); 327 ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
337 /* -EINVAL to handle old uncorrected drivers */ 328 /* -EINVAL to handle old uncorrected drivers */
338 if (ret != -EINVAL && ret != -ENOTTY) 329 if (ret != -EINVAL && ret != -ENOTTY)
339 return ret; 330 return ret;
@@ -349,7 +340,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
349 case BLKDISCARD: { 340 case BLKDISCARD: {
350 uint64_t range[2]; 341 uint64_t range[2];
351 342
352 if (!(file->f_mode & FMODE_WRITE)) 343 if (!(mode & FMODE_WRITE))
353 return -EBADF; 344 return -EBADF;
354 345
355 if (copy_from_user(range, (void __user *)arg, sizeof(range))) 346 if (copy_from_user(range, (void __user *)arg, sizeof(range)))
@@ -387,6 +378,6 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
387 if (ret != -ENOIOCTLCMD) 378 if (ret != -ENOIOCTLCMD)
388 return ret; 379 return ret;
389 380
390 return blkdev_driver_ioctl(inode, file, disk, cmd, arg); 381 ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
391} 382}
392EXPORT_SYMBOL_GPL(blkdev_ioctl); 383EXPORT_SYMBOL_GPL(blkdev_ioctl);