Add compat_ioctl to SG
Subsystems (2)
PATCH 1/1 Add compat_ioctl to SG
Add compat_ioctl forwarder to SG.
Signed-off-by Andi Kleen <[email protected]>
drivers/scsi/sg.c renamed from drivers/scsi/sg.c-o +26 -0
@@ -1037,6 +1037,29 @@ } } +#ifdef CONFIG_COMPAT +static long sg_compat_ioctl (struct file *filp,unsigned int cmd_in,unsigned long arg) +{ +Sg_device *sdp; +Sg_fd *sfp; +struct scsi_device *sdev; + +if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) +return -ENXIO ; + + sdev = sdp->device; +if (sdev->host->hostt->compat_ioctl) { +int ret; + + ret = sdev->host->hostt->compat_ioctl (sdev, cmd_in, (void __user *)arg); + +return ret; + } + +return -ENOIOCTLCMD ; +} +#endif +static unsigned int sg_poll (struct file *filp,poll_table * wait) {
@@ -1343,6 +1366,9 @@ .write = sg_write, .poll = sg_poll, .ioctl = sg_ioctl, +#ifdef CONFIG_COMPAT + .ioctl = sg_compat_ioctl, +#endif .open = sg_open, .mmap = sg_mmap, .release = sg_release,
Andi Kleen wrote:
<snip>
drivers/scsi/sg.c line 1371
Quoted 7 lines
drivers/scsi/sg.c renamed from drivers/scsi/sg.c-o +3
-0@@ -1343,6 +1366,9 @@ .write = sg_write, .poll = sg_poll, .ioctl = sg_ioctl, +#ifdef CONFIG_COMPAT + .ioctl = sg_compat_ioctl, +#endif
Andi,
Two initializations of ".ioctl" looks wrongs.
Comparing with the patch to sd should that be:
+ .compat_ioctl = sg_compat_ioctl,
??
Doug Gilbert
Quoted 14 lines · Douglas Gilbert
Andi Kleen wrote:
<snip>Review line 1371
Quoted 7 lines
(quoted diff) +3
-0@@ -1343,6 +1366,9 @@ .write = sg_write, .poll = sg_poll, .ioctl = sg_ioctl, +#ifdef CONFIG_COMPAT + .ioctl = sg_compat_ioctl, +#endifAndi,
Two initializations of ".ioctl" looks wrongs.
Comparing with the patch to sd should that be:
+ .compat_ioctl =sg_compat_ioctl,
Yep, you're right. Thanks for catching it. #$@#!-compiler doesn't warn about that. Here's a corrected patch.
-Andi
Add compat_ioctl to SG driver
Signed-off-by Andi Kleen <[email protected]>
drivers/scsi/sg.c renamed from drivers/scsi/sg.c-o +26 -0
@@ -1037,6 +1037,29 @@ } } +#ifdef CONFIG_COMPAT +static long sg_compat_ioctl (struct file *filp,unsigned int cmd_in,unsigned long arg) +{ +Sg_device *sdp; +Sg_fd *sfp; +struct scsi_device *sdev; + +if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) +return -ENXIO ; + + sdev = sdp->device; +if (sdev->host->hostt->compat_ioctl) { +int ret; + + ret = sdev->host->hostt->compat_ioctl (sdev, cmd_in, (void __user *)arg); + +return ret; + } + +return -ENOIOCTLCMD ; +} +#endif +static unsigned int sg_poll (struct file *filp,poll_table * wait) {
@@ -1343,6 +1366,9 @@ .write = sg_write, .poll = sg_poll, .ioctl = sg_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = sg_compat_ioctl, +#endif .open = sg_open, .mmap = sg_mmap, .release = sg_release,