scst/include/backport.h: Unbreak the RHEL 7 and RHEL 8 builds

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9571 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2021-09-07 00:44:03 +00:00
parent dfd45e735c
commit 3364429a0f

View File

@@ -2226,17 +2226,35 @@ static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd)
return scmd->request;
}
/*
* See also commit c611529e7cd3 ("sd: Honor block layer integrity handling
* flags"; v3.18).
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
{
/* To do: backport this function properly. */
WARN_ON_ONCE(true);
return 512;
}
#endif
/*
* See also commits 7ba46799d346 ("scsi: core: Add scsi_prot_ref_tag()
* helper") and ddd0bc756983 ("block: move ref_tag calculation func to the
* block layer"; v4.19).
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(RHEL_MAJOR)
static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
{
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 == 7
WARN_ON_ONCE(true);
return 0;
#else
struct request *rq = blk_mq_rq_from_pdu(scmd);
return t10_pi_ref_tag(rq);
#endif
}
#endif
#endif