From a891d6e9baf71bdaeb8c6e229a5c1d56c4430c82 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 5 Sep 2021 03:29:32 +0000 Subject: [PATCH] scst/include/backport.h: Backport more kernel functions git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9513 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/scst/include/backport.h b/scst/include/backport.h index ca787fc93..c7072ce78 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -51,6 +51,7 @@ #endif #include #include /* struct scsi_cmnd */ +#include /* scsi_build_sense_buffer() */ struct scsi_target; #include /* struct bsg_job */ #include /* get_unaligned_be64() */ @@ -261,6 +262,14 @@ static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len) for (i = 0; i < len; i++) dst[i] = cpu_to_be32(src[i]); } + +static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + dst[i] = be32_to_cpu(src[i]); +} #endif /* */ @@ -2113,6 +2122,15 @@ static inline struct workqueue_struct *alloc_workqueue(const char *fmt, #define WQ_SYSFS 0 #endif +/* + * To do: backport alloc_ordered_workqueue(). See also commit 81dcaf6516d8 + * ("workqueue: implement alloc_ordered_workqueue()"; v2.6.37). + */ +#ifndef alloc_ordered_workqueue +#define alloc_ordered_workqueue(fmt, flags, args...) \ + ({ WARN_ON_ONCE(true); ERR_PTR(-ENOMEM); }) +#endif + /* */ /* commit ed082d36 */ @@ -2307,6 +2325,19 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) +/* + * See also commit 67b465250e04 ("scsi: fc: start decoupling fc_block_scsi_eh + * from scsi_cmnd"; v4.14). + */ +static inline int fc_block_rport(struct fc_rport *rport) +{ + /* To do: backport this function. */ + WARN_ON_ONCE(true); + return 0; +} +#endif + /* */ /* See also commit a7dff3ad4787 ("scsi: fc: add FPIN ELS definition") # v5.2 */