vserver 1.9.3
[linux-2.6.git] / drivers / scsi / scsi_ioctl.c
index 03390c0..e26adda 100644 (file)
@@ -5,23 +5,21 @@
  *   for the ones that remain
  */
 #include <linux/module.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/page.h>
-
+#include <linux/blkdev.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/string.h>
+#include <asm/uaccess.h>
 
-#include <linux/blkdev.h>
-#include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_host.h>
 #include <scsi/scsi_ioctl.h>
+#include <scsi/scsi_request.h>
 
 #include "scsi_logging.h"
 
@@ -393,6 +391,21 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
        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)))
@@ -419,12 +432,8 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
        case SCSI_IOCTL_DOORUNLOCK:
                return scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
        case SCSI_IOCTL_TEST_UNIT_READY:
-               scsi_cmd[0] = TEST_UNIT_READY;
-               scsi_cmd[1] = 0;
-               scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
-               scsi_cmd[4] = 0;
-               return ioctl_internal_command(sdev, scsi_cmd,
-                                  IOCTL_NORMAL_TIMEOUT, NORMAL_RETRIES);
+               return scsi_test_unit_ready(sdev, IOCTL_NORMAL_TIMEOUT,
+                                           NORMAL_RETRIES);
        case SCSI_IOCTL_START_UNIT:
                scsi_cmd[0] = START_STOP;
                scsi_cmd[1] = 0;
@@ -447,19 +456,3 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
        }
        return -EINVAL;
 }
-
-/*
- * Just like scsi_ioctl, only callable from kernel space with no 
- * fs segment fiddling.
- */
-
-int kernel_scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg)
-{
-       mm_segment_t oldfs;
-       int tmp;
-       oldfs = get_fs();
-       set_fs(get_ds());
-       tmp = scsi_ioctl(sdev, cmd, arg);
-       set_fs(oldfs);
-       return tmp;
-}