diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-08-29 20:34:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:47:26 -0400 |
commit | 633a08b81206122469365b4c72eaeb71f04f2cb4 (patch) | |
tree | 9cd30507efd30645d30d351c7ad0d5966f806532 /block/ioctl.c | |
parent | a0eb62a0a4470fef5a5f41e7f1442fdd667220ef (diff) |
[PATCH] introduce __blkdev_driver_ioctl()
Analog of blkdev_driver_ioctl() with sane arguments. For
now uses fake struct file, by the end of the series it won't
and blkdev_driver_ioctl() will become a wrapper around it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r-- | block/ioctl.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index 38bee321e1fa..9a26ace6d042 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -283,6 +283,37 @@ int blkdev_driver_ioctl(struct inode *inode, struct file *file, | |||
283 | } | 283 | } |
284 | EXPORT_SYMBOL_GPL(blkdev_driver_ioctl); | 284 | EXPORT_SYMBOL_GPL(blkdev_driver_ioctl); |
285 | 285 | ||
286 | int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, | ||
287 | unsigned cmd, unsigned long arg) | ||
288 | { | ||
289 | struct gendisk *disk = bdev->bd_disk; | ||
290 | int ret; | ||
291 | /* you bet it'll go away by the end of patch series */ | ||
292 | struct file fake_file = {}; | ||
293 | struct dentry fake_dentry = {}; | ||
294 | fake_file.f_mode = mode; | ||
295 | fake_file.f_path.dentry = &fake_dentry; | ||
296 | fake_dentry.d_inode = bdev->bd_inode; | ||
297 | |||
298 | if (disk->fops->unlocked_ioctl) | ||
299 | return disk->fops->unlocked_ioctl(&fake_file, cmd, arg); | ||
300 | |||
301 | if (disk->fops->ioctl) { | ||
302 | lock_kernel(); | ||
303 | ret = disk->fops->ioctl(bdev->bd_inode, &fake_file, cmd, arg); | ||
304 | unlock_kernel(); | ||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | return -ENOTTY; | ||
309 | } | ||
310 | /* | ||
311 | * For the record: _GPL here is only because somebody decided to slap it | ||
312 | * on the previous export. Sheer idiocy, since it wasn't copyrightable | ||
313 | * at all and could be open-coded without any exports by anybody who cares. | ||
314 | */ | ||
315 | EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl); | ||
316 | |||
286 | /* | 317 | /* |
287 | * always keep this in sync with compat_blkdev_ioctl() and | 318 | * always keep this in sync with compat_blkdev_ioctl() and |
288 | * compat_blkdev_locked_ioctl() | 319 | * compat_blkdev_locked_ioctl() |