X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fblock%2Fioctl.c;h=6d7bcc9da9e72f806d0c3fe77aacca8c1ec896e3;hb=8e8ece46a861c84343256819eaec77e608ff9217;hp=43ff0c6ed90067ac678032d2170ea8092ed6380d;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/drivers/block/ioctl.c b/drivers/block/ioctl.c index 43ff0c6ed..6d7bcc9da 100644 --- a/drivers/block/ioctl.c +++ b/drivers/block/ioctl.c @@ -3,6 +3,7 @@ #include #include #include +#include #include static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user *arg) @@ -220,3 +221,21 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, } return -ENOTTY; } + +/* Most of the generic ioctls are handled in the normal fallback path. + This assumes the blkdev's low level compat_ioctl always returns + ENOIOCTLCMD for unknown ioctls. */ +long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) +{ + struct block_device *bdev = file->f_dentry->d_inode->i_bdev; + struct gendisk *disk = bdev->bd_disk; + int ret = -ENOIOCTLCMD; + if (disk->fops->compat_ioctl) { + lock_kernel(); + ret = disk->fops->compat_ioctl(file, cmd, arg); + unlock_kernel(); + } + return ret; +} + +EXPORT_SYMBOL_GPL(blkdev_ioctl);