public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add compat_ioctl to SG
@ 2005-01-18 11:07 Andi Kleen
  2005-01-18 11:35 ` Douglas Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2005-01-18 11:07 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi, dgilbert

Add compat_ioctl forwarder to SG. 

Signed-off-by: Andi Kleen <ak@muc.de>

diff -u linux-2.6.11-rc1-bk4/drivers/scsi/sg.c-o linux-2.6.11-rc1-bk4/drivers/scsi/sg.c
--- linux-2.6.11-rc1-bk4/drivers/scsi/sg.c-o	2005-01-04 12:13:07.000000000 +0100
+++ linux-2.6.11-rc1-bk4/drivers/scsi/sg.c	2005-01-18 05:24:28.000000000 +0100
@@ -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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add compat_ioctl to SG
  2005-01-18 11:07 [PATCH] Add compat_ioctl to SG Andi Kleen
@ 2005-01-18 11:35 ` Douglas Gilbert
  2005-01-18 11:43   ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Gilbert @ 2005-01-18 11:35 UTC (permalink / raw)
  To: Andi Kleen; +Cc: James.Bottomley, linux-scsi

Andi Kleen wrote:
<snip>
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add compat_ioctl to SG
  2005-01-18 11:35 ` Douglas Gilbert
@ 2005-01-18 11:43   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2005-01-18 11:43 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: James.Bottomley, linux-scsi

On Tue, Jan 18, 2005 at 09:35:53PM +1000, Douglas Gilbert wrote:
> Andi Kleen wrote:
> <snip>
> >@@ -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,

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 <ak@muc.de>

diff -u linux-2.6.11-rc1-bk4/drivers/scsi/sg.c-o linux-2.6.11-rc1-bk4/drivers/scsi/sg.c
--- linux-2.6.11-rc1-bk4/drivers/scsi/sg.c-o	2005-01-04 12:13:07.000000000 +0100
+++ linux-2.6.11-rc1-bk4/drivers/scsi/sg.c	2005-01-18 05:24:28.000000000 +0100
@@ -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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-18 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-18 11:07 [PATCH] Add compat_ioctl to SG Andi Kleen
2005-01-18 11:35 ` Douglas Gilbert
2005-01-18 11:43   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox