scst: Introduce scst_scsi_execute()

This patch does not change any functionality but makes it easier
to port SCST to Linux kernel v4.11.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7152 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2017-04-26 23:53:11 +00:00
parent 33af3ccb46
commit 0371382394
5 changed files with 37 additions and 33 deletions
+4
View File
@@ -5694,6 +5694,10 @@ struct scst_data_descriptor {
};
void scst_write_same(struct scst_cmd *cmd, struct scst_data_descriptor *where);
int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
int data_direction, void *buffer, unsigned bufflen,
unsigned char *sense, int timeout, int retries,
u64 flags);
__be64 scst_pack_lun(const uint64_t lun, enum scst_lun_addr_method addr_method);
uint64_t scst_unpack_lun(const uint8_t *lun, int len);
+3 -7
View File
@@ -96,13 +96,9 @@ static int cdrom_attach(struct scst_device *dev)
data_dir = SCST_DATA_READ;
TRACE_DBG("%s", "Doing READ_CAPACITY");
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0);
TRACE_DBG("READ_CAPACITY done: %x", rc);
+3 -7
View File
@@ -193,13 +193,9 @@ static int disk_attach(struct scst_device *dev)
data_dir = SCST_DATA_READ;
TRACE_DBG("%s", "Doing READ_CAPACITY");
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0);
TRACE_DBG("READ_CAPACITY done: %x", rc);
+3 -7
View File
@@ -197,13 +197,9 @@ static int modisk_attach(struct scst_device *dev)
data_dir = SCST_DATA_READ;
TRACE_DBG("%s", "Doing READ_CAPACITY");
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0);
TRACE_DBG("READ_CAPACITY done: %x", rc);
+24 -12
View File
@@ -6777,6 +6777,25 @@ out:
return res;
}
int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
int data_direction, void *buffer, unsigned bufflen,
unsigned char *sense, int timeout, int retries, u64 flags)
{
return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
NULL, /* sshdr */
#endif
timeout, retries, flags
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
, 0 /* rq_flags */
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL /* resid */
#endif
);
}
EXPORT_SYMBOL(scst_scsi_execute);
static void scst_send_release(struct scst_device *dev)
{
struct scsi_device *scsi_dev;
@@ -6801,12 +6820,8 @@ static void scst_send_release(struct scst_device *dev)
TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to "
"SCSI mid-level");
rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
sense, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
rc = scst_scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
sense, 15, 0, 0);
TRACE_DBG("RELEASE done: %x", rc);
if (scsi_status_is_good(rc)) {
@@ -13248,12 +13263,9 @@ int scst_obtain_device_parameters(struct scst_device *dev,
memset(sense_buffer, 0, sizeof(sense_buffer));
TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE");
rc = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer,
sizeof(buffer), sense_buffer, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
rc = scst_scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ,
buffer, sizeof(buffer), sense_buffer,
15, 0, 0);
TRACE_DBG("MODE_SENSE done: %x", rc);