ide: cleanup generic_ide_ioctl()

* Fix intendation for the main 'switch ()'.

* 'switch ()' -> 'if ()' for HDIO_DRIVE_TASKFILE case.

* Move HDIO_SET_NICE case under HDIO_GET_NICE one.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent aa768773
......@@ -565,7 +565,8 @@ static const struct ide_ioctl_devset ide_ioctl_settings[] = {
{ 0 }
};
int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
int generic_ide_ioctl(ide_drive_t *drive, struct file *file,
struct block_device *bdev,
unsigned int cmd, unsigned long arg)
{
int err;
......@@ -582,44 +583,36 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
return ide_get_identity_ioctl(drive, cmd, arg);
case HDIO_GET_NICE:
return ide_get_nice_ioctl(drive, arg);
case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return ide_set_nice_ioctl(drive, arg);
#ifdef CONFIG_IDE_TASK_IOCTL
case HDIO_DRIVE_TASKFILE:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
switch(drive->media) {
case ide_disk:
if (drive->media == ide_disk)
return ide_taskfile_ioctl(drive, cmd, arg);
default:
return -ENOMSG;
}
#endif /* CONFIG_IDE_TASK_IOCTL */
#endif
case HDIO_DRIVE_CMD:
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
return ide_cmd_ioctl(drive, cmd, arg);
case HDIO_DRIVE_TASK:
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
return ide_task_ioctl(drive, cmd, arg);
case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return ide_set_nice_ioctl(drive, arg);
case HDIO_DRIVE_RESET:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return generic_drive_reset(drive);
case HDIO_GET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (put_user(BUSSTATE_ON, (long __user *)arg))
return -EFAULT;
return 0;
case HDIO_SET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment