+
+/* 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);