From 3364429a0f25d4f67440f612a6da0aec67dd749f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 7 Sep 2021 00:44:03 +0000 Subject: [PATCH] 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 --- scst/include/backport.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index c7072ce78..935de8ede 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -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