mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scst: Port to Linux kernel v4.19
In Linux kernel v4.19 the function scsi_execute() has been replaced by the
following macro:
/* Make sure any sense buffer is the correct size. */
#define scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
sshdr, timeout, retries, flags, rq_flags, resid) \
({ \
BUILD_BUG_ON((sense) != NULL && \
sizeof(sense) != SCSI_SENSE_BUFFERSIZE); \
__scsi_execute(sdev, cmd, data_direction, buffer, bufflen, \
sense, sshdr, timeout, retries, flags, rq_flags, \
resid); \
})
This macro only accepts a sense buffer that has been declared as an array
but no sense buffers that have been passed as a pointer to a function. To
avoid build errors, convert scst_scsi_execute() from a function into a macro.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7473 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -5728,10 +5728,38 @@ ssize_t scst_readv(struct file *file, const struct iovec *vec,
|
||||
ssize_t scst_writev(struct file *file, const struct iovec *vec,
|
||||
unsigned long vlen, loff_t *pos);
|
||||
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 int bufflen,
|
||||
unsigned char *sense, int timeout, int retries,
|
||||
u64 flags);
|
||||
/**
|
||||
* scsi_execute - insert a SCSI request and wait for the result
|
||||
* @sdev: scsi device
|
||||
* @cmd: scsi command
|
||||
* @data_direction: data direction
|
||||
* @buffer: data buffer
|
||||
* @bufflen: length of buffer - DMA_TO_DEVICE, DMA_FROM_DEVICE or DMA_NONE
|
||||
* @sense: optional sense buffer
|
||||
* @timeout: request timeout in seconds
|
||||
* @retries: number of times to retry request
|
||||
* @flags: flags for ->cmd_flags, e.g. REQ_FAILFAST_DEV
|
||||
*
|
||||
* Returns the scsi_cmnd result field if a command was executed, or a negative
|
||||
* Linux error code if we didn't get that far.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#define scst_scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
timeout, retries, flags) \
|
||||
scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
NULL /* sshdr */, timeout, retries, flags, \
|
||||
0 /* rq_flags */, NULL /* resid */)
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
#define scst_scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
timeout, retries, flags) \
|
||||
scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
timeout, retries, flags, NULL /* resid */)
|
||||
#else
|
||||
#define scst_scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
timeout, retries, flags) \
|
||||
scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \
|
||||
timeout, retries, flags)
|
||||
#endif
|
||||
|
||||
__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);
|
||||
|
||||
@@ -6862,40 +6862,6 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_execute - insert a SCSI request and wait for the result
|
||||
* @sdev: scsi device
|
||||
* @cmd: scsi command
|
||||
* @data_direction: data direction
|
||||
* @buffer: data buffer
|
||||
* @bufflen: length of buffer - DMA_TO_DEVICE, DMA_FROM_DEVICE or DMA_NONE
|
||||
* @sense: optional sense buffer
|
||||
* @timeout: request timeout in seconds
|
||||
* @retries: number of times to retry request
|
||||
* @flags: flags for ->cmd_flags, e.g. REQ_FAILFAST_DEV
|
||||
*
|
||||
* Returns the scsi_cmnd result field if a command was executed, or a negative
|
||||
* Linux error code if we didn't get that far.
|
||||
*/
|
||||
int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
|
||||
int data_direction, void *buffer, unsigned int 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;
|
||||
|
||||
Reference in New Issue
Block a user