Skip to contentSkip to conversation

Add compat_ioctl to scsi host structure

PATCH In review Andi Kleen 2 participants 5 messages Jan 18, 2005 – Jan 19, 2005 SCSI

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Add compat_ioctl to scsi host structure

Add a call vector for 32bit compat ioctls to the SCSI host structure. This is needed for some followon patches.

include/scsi/scsi_host.h renamed from include/scsi/scsi_host.h-o +10 -0
diff -u linux-2.6.11-rc1-bk4/include/scsi/scsi_host.h-o linux-2.6.11-rc1-bk4/include/scsi/scsi_host.h
@@ -71,6 +71,16 @@
 	 * Status: OPTIONAL
 	 */
 	int (* ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+
+
+	/* 
+	 * Compat handler. Handle 32bit ABI.
+	 * When unknown ioctl is passed return -ENOIOCTLCMD.
+	 * When called the BKL is not hold.
+	 * Status: OPTIONAL
+	 */
+	int (* compat_ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+
 	
 	/*
 	 * The queuecommand function is used to queue up a scsi
#1 lore raw
Quoted 4 lines · Andi Kleen

Add a call vector for 32bit compat ioctls to the SCSI host structure. This is needed for some followon patches.

Shouldn't this also be surrounded by #ifdef CONFIG_COMPAT (on the grounds that you never fill it in unless CONFIG_COMPAT is defined)?

James

author
#2 lore raw
Quoted 8 lines · James Bottomley
Quoted 4 lines · Andi Kleen

Add a call vector for 32bit compat ioctls to the SCSI host structure. This is needed for some followon patches.

Shouldn't this also be surrounded by #ifdef CONFIG_COMPAT (on the grounds that you never fill it in unless CONFIG_COMPAT is defined)?

At least the standard file_operations has it without ifdef. I guess it doesn't hurt too much even on non compat systems.

-Andi

#3 lore raw
Quoted 6 lines · Andi Kleen
Quoted 2 lines · James Bottomley

Shouldn't this also be surrounded by #ifdef CONFIG_COMPAT (on the grounds that you never fill it in unless CONFIG_COMPAT is defined)?

At least the standard file_operations has it without ifdef. I guess it doesn't hurt too much even on non compat systems.

Well, I wasn't really thinking of saving the four or eight bytes for the
pointer: It looks, from all the other patches, that the policy is that any compat ioctl code should be surrounded by #ifdef CONFIG_COMPAT. Thus, an easy way to enforce this policy is to do the same to the structure definition, so the compiler will error if the driver writer doesn't do it and tries to compile on a non-CONFIG_COMPAT platform.

James

author
#4 lore raw
Quoted 8 lines · James Bottomley
Quoted 6 lines · Andi Kleen
Quoted 2 lines · James Bottomley

Shouldn't this also be surrounded by #ifdef CONFIG_COMPAT (on the grounds that you never fill it in unless CONFIG_COMPAT is defined)?

At least the standard file_operations has it without ifdef. I guess it doesn't hurt too much even on non compat systems.

Quoted 6 lines

Well, I wasn't really thinking of saving the four or eight bytes for the
pointer: It looks, from all the other patches, that the policy is that any compat ioctl code should be surrounded by #ifdef CONFIG_COMPAT. Thus, an easy way to enforce this policy is to do the same to the structure definition, so the compiler will error if the driver writer doesn't do it and tries to compile on a non-CONFIG_COMPAT platform.

Here's a new patch with the ifdef.

Add compat_ioctl vector to scsi_host.

include/scsi/scsi_host.h renamed from include/scsi/scsi_host.h-o +12 -1
diff -u linux-2.6.11-rc1-bk4/include/scsi/scsi_host.h-o linux-2.6.11-rc1-bk4/include/scsi/scsi_host.h
@@ -71,7 +71,18 @@
 	 * Status: OPTIONAL
 	 */
 	int (* ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
-	
+
+
+#ifdef CONFIG_COMPAT
+	/* 
+	 * Compat handler. Handle 32bit ABI.
+	 * When unknown ioctl is passed return -ENOIOCTLCMD.
+	 *
+	 * Status: OPTIONAL
+	 */
+	int (* compat_ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+#endif
+
 	/*
 	 * The queuecommand function is used to queue up a scsi
 	 * command block to the LLDD.  When the driver finished

diff -u linux-2.6.11-rc1-bk4/include/scsi/scsi_ioctl.h-o linux-2.6.11-rc1-bk4/include/scsi/scsi_ioctl.h