mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 18:23:53 +08:00
compat_ioctl: move cdrom commands into cdrom.c
There is no need for the special cases for the cdrom ioctls any more now, so make sure that each cdrom driver has a .compat_ioctl() callback and calls cdrom_compat_ioctl() directly there. Reviewed-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
77b9040195
commit
64cbfa9655
@ -160,42 +160,6 @@ static int compat_blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
case HDIO_DRIVE_CMD:
|
||||
/* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */
|
||||
case 0x330:
|
||||
/* CDROM stuff */
|
||||
case CDROMPAUSE:
|
||||
case CDROMRESUME:
|
||||
case CDROMPLAYMSF:
|
||||
case CDROMPLAYTRKIND:
|
||||
case CDROMREADTOCHDR:
|
||||
case CDROMREADTOCENTRY:
|
||||
case CDROMSTOP:
|
||||
case CDROMSTART:
|
||||
case CDROMEJECT:
|
||||
case CDROMVOLCTRL:
|
||||
case CDROMSUBCHNL:
|
||||
case CDROMMULTISESSION:
|
||||
case CDROM_GET_MCN:
|
||||
case CDROMRESET:
|
||||
case CDROMVOLREAD:
|
||||
case CDROMSEEK:
|
||||
case CDROMPLAYBLK:
|
||||
case CDROMCLOSETRAY:
|
||||
case CDROM_DISC_STATUS:
|
||||
case CDROM_CHANGER_NSLOTS:
|
||||
case CDROM_GET_CAPABILITY:
|
||||
case CDROM_SEND_PACKET:
|
||||
/* Ignore cdrom.h about these next 5 ioctls, they absolutely do
|
||||
* not take a struct cdrom_read, instead they take a struct cdrom_msf
|
||||
* which is compatible.
|
||||
*/
|
||||
case CDROMREADMODE2:
|
||||
case CDROMREADMODE1:
|
||||
case CDROMREADRAW:
|
||||
case CDROMREADCOOKED:
|
||||
case CDROMREADALL:
|
||||
/* DVD ioctls */
|
||||
case DVD_READ_STRUCT:
|
||||
case DVD_WRITE_STRUCT:
|
||||
case DVD_AUTH:
|
||||
arg = (unsigned long)compat_ptr(arg);
|
||||
/* These intepret arg as an unsigned long, not as a pointer,
|
||||
* so we must not do compat_ptr() conversion. */
|
||||
@ -211,15 +175,6 @@ static int compat_blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
case HDIO_SET_ACOUSTIC:
|
||||
case HDIO_SET_BUSSTATE:
|
||||
case HDIO_SET_ADDRESS:
|
||||
case CDROMEJECT_SW:
|
||||
case CDROM_SET_OPTIONS:
|
||||
case CDROM_CLEAR_OPTIONS:
|
||||
case CDROM_SELECT_SPEED:
|
||||
case CDROM_SELECT_DISC:
|
||||
case CDROM_MEDIA_CHANGED:
|
||||
case CDROM_DRIVE_STATUS:
|
||||
case CDROM_LOCKDOOR:
|
||||
case CDROM_DEBUG:
|
||||
break;
|
||||
default:
|
||||
/* unknown ioctl number */
|
||||
|
@ -275,6 +275,9 @@ static const struct block_device_operations pcd_bdops = {
|
||||
.open = pcd_block_open,
|
||||
.release = pcd_block_release,
|
||||
.ioctl = pcd_block_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.ioctl = blkdev_compat_ptr_ioctl,
|
||||
#endif
|
||||
.check_events = pcd_block_check_events,
|
||||
};
|
||||
|
||||
|
@ -518,6 +518,9 @@ static const struct block_device_operations gdrom_bdops = {
|
||||
.release = gdrom_bdops_release,
|
||||
.check_events = gdrom_bdops_check_events,
|
||||
.ioctl = gdrom_bdops_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.ioctl = blkdev_compat_ptr_ioctl,
|
||||
#endif
|
||||
};
|
||||
|
||||
static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id)
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#define IDECD_VERSION "5.00"
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -1710,6 +1711,39 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int idecd_locked_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
|
||||
void __user *argp = compat_ptr(arg);
|
||||
int err;
|
||||
|
||||
switch (cmd) {
|
||||
case CDROMSETSPINDOWN:
|
||||
return idecd_set_spindown(&info->devinfo, (unsigned long)argp);
|
||||
case CDROMGETSPINDOWN:
|
||||
return idecd_get_spindown(&info->devinfo, (unsigned long)argp);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return cdrom_ioctl(&info->devinfo, bdev, mode, cmd,
|
||||
(unsigned long)argp);
|
||||
}
|
||||
|
||||
static int idecd_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ide_cd_mutex);
|
||||
ret = idecd_locked_compat_ioctl(bdev, mode, cmd, arg);
|
||||
mutex_unlock(&ide_cd_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned int idecd_check_events(struct gendisk *disk,
|
||||
unsigned int clearing)
|
||||
@ -1732,6 +1766,9 @@ static const struct block_device_operations idecd_ops = {
|
||||
.open = idecd_open,
|
||||
.release = idecd_release,
|
||||
.ioctl = idecd_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = idecd_compat_ioctl,
|
||||
#endif
|
||||
.check_events = idecd_check_events,
|
||||
.revalidate_disk = idecd_revalidate_disk
|
||||
};
|
||||
|
@ -628,12 +628,8 @@ static int sr_block_compat_ioctl(struct block_device *bdev, fmode_t mode, unsign
|
||||
goto put;
|
||||
}
|
||||
|
||||
/*
|
||||
* CDROM ioctls are handled in the block layer, but
|
||||
* do the scsi blk ioctls here.
|
||||
*/
|
||||
ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
|
||||
if (ret != -ENOTTY)
|
||||
ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, (unsigned long)argp);
|
||||
if (ret != -ENOSYS)
|
||||
goto put;
|
||||
|
||||
ret = scsi_compat_ioctl(sdev, cmd, argp);
|
||||
|
Loading…
Reference in New Issue
Block a user