mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-08 07:38:10 +00:00
scsi: sg: Consolidate compat ioctl handling
Merge the native and compat ioctl handlers into a single one using in_compat_syscall(). Link: https://lore.kernel.org/r/20210724072033.1284840-6-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
bce9667509
commit
2c2db2c605
1 changed files with 3 additions and 22 deletions
|
@ -1166,28 +1166,11 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
||||||
if (ret != -ENOIOCTLCMD)
|
if (ret != -ENOIOCTLCMD)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (in_compat_syscall())
|
||||||
|
return scsi_compat_ioctl(sdp->device, cmd_in, p);
|
||||||
return scsi_ioctl(sdp->device, cmd_in, p);
|
return scsi_ioctl(sdp->device, cmd_in, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
|
||||||
static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
|
||||||
{
|
|
||||||
void __user *p = compat_ptr(arg);
|
|
||||||
Sg_device *sdp;
|
|
||||||
Sg_fd *sfp;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
|
||||||
return -ENXIO;
|
|
||||||
|
|
||||||
ret = sg_ioctl_common(filp, sdp, sfp, cmd_in, p);
|
|
||||||
if (ret != -ENOIOCTLCMD)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return scsi_compat_ioctl(sdp->device, cmd_in, p);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static __poll_t
|
static __poll_t
|
||||||
sg_poll(struct file *filp, poll_table * wait)
|
sg_poll(struct file *filp, poll_table * wait)
|
||||||
{
|
{
|
||||||
|
@ -1441,9 +1424,7 @@ static const struct file_operations sg_fops = {
|
||||||
.write = sg_write,
|
.write = sg_write,
|
||||||
.poll = sg_poll,
|
.poll = sg_poll,
|
||||||
.unlocked_ioctl = sg_ioctl,
|
.unlocked_ioctl = sg_ioctl,
|
||||||
#ifdef CONFIG_COMPAT
|
.compat_ioctl = compat_ptr_ioctl,
|
||||||
.compat_ioctl = sg_compat_ioctl,
|
|
||||||
#endif
|
|
||||||
.open = sg_open,
|
.open = sg_open,
|
||||||
.mmap = sg_mmap,
|
.mmap = sg_mmap,
|
||||||
.release = sg_release,
|
.release = sg_release,
|
||||||
|
|
Loading…
Add table
Reference in a new issue