[PATCH] get the kernel to warn about deprecated SCSI ioctls

James Bottomley
2004-08-19T16:19:04Z

The non unique SCSI ioctls:

SCSI_IOCTL_SEND_COMMAND
SCSI_IOCTL_TEST_UNIT_READY
SCSI_IOCTL_BENCHMARK_COMMAND
SCSI_IOCTL_SYNC
SCSI_IOCTL_START_UNIT
SCSI_IOCTL_STOP_UNIT

Have been deprecated for a while now. We should make the kernel
complain when a program actually uses one of them, so users have had
adequate warning before they are removed.

James

===== drivers/scsi/scsi_ioctl.c 1.28 vs edited =====
--- 1.28/drivers/scsi/scsi_ioctl.c 2004-06-26 17:40:24 -05:00
+++ edited/drivers/scsi/scsi_ioctl.c 2004-08-19 09:45:22 -05:00
@@ -391,6 +391,21 @@
if (!scsi_block_when_processing_errors(sdev))
return -ENODEV;

+ /* Check for deprecated ioctls ... all the ioctls which don't
+ * follow the new unique numbering scheme are deprecated */
+ switch (cmd) {
+ case SCSI_IOCTL_SEND_COMMAND:
+ case SCSI_IOCTL_TEST_UNIT_READY:
+ case SCSI_IOCTL_BENCHMARK_COMMAND:
+ case SCSI_IOCTL_SYNC:
+ case SCSI_IOCTL_START_UNIT:
+ case SCSI_IOCTL_STOP_UNIT:
+ printk(KERN_WARNING "program %s is using a deprecated SCSI ioctl, please convert it to SG_IO\n", current->comm);
+ break;
+ default:
+ break;
+ }
+
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
if (verify_area(VERIFY_WRITE, arg, sizeof(struct scsi_idlun)))