diff --git a/qla2x00t-32gbit/qla_dfs.c b/qla2x00t-32gbit/qla_dfs.c index d5ebcf7d7..c718f1bc9 100644 --- a/qla2x00t-32gbit/qla_dfs.c +++ b/qla2x00t-32gbit/qla_dfs.c @@ -21,8 +21,12 @@ qla_dfs_rport_get(struct fc_port *fp, int attr_id, u64 *val) /* Only supported for FC-NVMe devices that are registered. */ if (!(fp->nvme_flag & NVME_FLAG_REGISTERED)) return -EIO; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) *val = fp->nvme_remote_port->dev_loss_tmo; break; +#else + return -EINVAL; +#endif default: return -EINVAL; } @@ -37,7 +41,7 @@ qla_dfs_rport_set(struct fc_port *fp, int attr_id, u64 val) /* Only supported for FC-NVMe devices that are registered. */ if (!(fp->nvme_flag & NVME_FLAG_REGISTERED)) return -EIO; -#if (IS_ENABLED(CONFIG_NVME_FC)) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) && IS_ENABLED(CONFIG_NVME_FC) return nvme_fc_set_remoteport_devloss(fp->nvme_remote_port, val); #else /* CONFIG_NVME_FC */ diff --git a/qla2x00t-32gbit/qla_target.c b/qla2x00t-32gbit/qla_target.c index 198dc2009..4d5399146 100644 --- a/qla2x00t-32gbit/qla_target.c +++ b/qla2x00t-32gbit/qla_target.c @@ -2136,7 +2136,9 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha, if (abort_cmd->qpair) { mcmd->qpair = abort_cmd->qpair; +#if HAVE_SE_CMD_CPUID mcmd->se_cmd.cpuid = abort_cmd->se_cmd.cpuid; +#endif mcmd->abort_io_attr = abort_cmd->atio.u.isp24.attr; mcmd->flags = QLA24XX_MGMT_ABORT_IO_ATTR_VALID; } diff --git a/scst/include/backport.h b/scst/include/backport.h index c58d43b93..49bc48f66 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -381,6 +381,40 @@ static inline bool cpumask_equal(const cpumask_t *src1p, } #endif +/* */ + +/* + * See also commit c64688081490 ("debugfs: add support for self-protecting + * attribute file fops") # v4.7. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) +#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \ +static int __fops ## _open(struct inode *inode, struct file *file) \ +{ \ + __simple_attr_check_format(__fmt, 0ull); \ + return simple_attr_open(inode, file, __get, __set, __fmt); \ +} \ +static const struct file_operations __fops = { \ + .owner = THIS_MODULE, \ + .open = __fops ## _open, \ + .release = simple_attr_release, \ + .read = debugfs_attr_read, \ + .write = debugfs_attr_write, \ + .llseek = no_llseek, \ +} + +static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf, + size_t len, loff_t *ppos) +{ + return -ENOENT; +} +static inline ssize_t debugfs_attr_write(struct file *file, + const char __user *buf, size_t len, loff_t *ppos) +{ + return -ENOENT; +} +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) @@ -1683,6 +1717,28 @@ static inline void sg_unmark_end(struct scatterlist *sg) #define MIN_NICE -20 #endif +/* */ + +/* + * See also commit a08f06bb7a07 ("seq_file: Introduce DEFINE_SHOW_ATTRIBUTE() + * helper macro") # v4.16. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) +#define DEFINE_SHOW_ATTRIBUTE(__name) \ +static int __name ## _open(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, __name ## _show, inode->i_private); \ +} \ + \ +static const struct file_operations __name ## _fops = { \ + .owner = THIS_MODULE, \ + .open = __name ## _open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +} +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)