7 #include <linux/module.h>
10 #include <linux/errno.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
14 #include <linux/string.h>
15 #include <asm/uaccess.h>
17 #include <scsi/scsi.h>
28 #define NORMAL_RETRIES 5
29 #define IOCTL_NORMAL_TIMEOUT (10 * HZ)
31 #define MAX_BUF PAGE_SIZE
43 unsigned int len, slen;
50 if (host->
hostt->info)
51 string = host->
hostt->info(host);
53 string = host->
hostt->name;
88 static int ioctl_internal_command(
struct scsi_device *sdev,
char *
cmd,
97 &sshdr, timeout, retries,
NULL);
102 (scsi_sense_valid(&sshdr))) {
103 switch (sshdr.sense_key) {
109 "ILLEGAL REQUEST asc=0x%x ascq=0x%x\n",
110 sshdr.asc, sshdr.ascq);
123 "ioctl_internal_command return code = %x\n",
149 ret = ioctl_internal_command(sdev, scsi_cmd,
167 static int scsi_ioctl_get_pci(
struct scsi_device *sdev,
void __user *
arg)
175 name = dev_name(dev);
221 "ioctl, please convert it to SG_IO\n",
current->comm);
233 + ((sdev->
lun & 0xff) << 8)
234 + ((sdev->
channel & 0xff) << 16)
235 + ((sdev->
host->host_no & 0xff) << 24),
236 &((
struct scsi_idlun
__user *)arg)->dev_id);
238 &((
struct scsi_idlun
__user *)arg)->host_unique_id);
243 return ioctl_probe(sdev->
host, arg);
258 scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
260 return ioctl_internal_command(sdev, scsi_cmd,
265 scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
267 return ioctl_internal_command(sdev, scsi_cmd,
270 return scsi_ioctl_get_pci(sdev, arg);
272 if (sdev->
host->hostt->ioctl)
273 return sdev->
host->hostt->ioctl(sdev, cmd, arg);
287 void __user *arg,
int ndelay)
295 if (scsi_host_in_recovery(sdev->
host))