From 5e313fddf465d98234f90a9b3dcefaefe81bb1fb Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 25 Nov 2021 00:39:17 +0000 Subject: [PATCH] fcst: Rework the fc_fill_fc_hdr() compatibility check Decide which SCSI header file to include based on a compile time check instead of trying to derive that choice from the UEK kernel version. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9606 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/Kbuild | 2 +- fcst/ft_cmd.c | 9 +++++++-- fcst/ft_io.c | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/fcst/Kbuild b/fcst/Kbuild index 1762fa4a0..f7b6dd2a1 100644 --- a/fcst/Kbuild +++ b/fcst/Kbuild @@ -1,5 +1,5 @@ KBUILD_EXTRA_SYMBOLS=$(src)/../scst/src/Module.symvers -ccflags-y += -I$(src)/../scst/include $(shell ev=$$(basename $$(pwd)); echo "ev=$$ev" >&2; [ "$${ev/uek}" != "$${ev}" ] && ev=$${ev/*.el/} && echo -DUEK_RELEASE=$${ev/uek.*}) +ccflags-y += -I$(src)/../scst/include $(shell grep -qw fc_fill_fc_hdr $$(pwd)/include/scsi/fc_encode.h 2>/dev/null && echo -DFC_FILL_FC_HDR_IN_SCSI_FC_ENCODE_H) obj-$(CONFIG_FCST) += fcst.o diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index 9b9eac7f6..a868eaec2 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -19,10 +19,15 @@ #include #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) && !defined(UEK_RELEASE) +/* + * See also upstream commit e31ac898ac29 ("scsi: libfc: Move scsi/fc_encode.h + * to libfc"). That commit moved fc_fill_fc_hdr() from into + * . + */ +#if defined(FC_FILL_FC_HDR_IN_SCSI_FC_ENCODE_H) #include #else -#include +#include #endif #include "fcst.h" diff --git a/fcst/ft_io.c b/fcst/ft_io.c index 9e202517d..face322fe 100644 --- a/fcst/ft_io.c +++ b/fcst/ft_io.c @@ -24,10 +24,15 @@ #include #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) && !defined(UEK_RELEASE) +/* + * See also upstream commit e31ac898ac29 ("scsi: libfc: Move scsi/fc_encode.h + * to libfc"). That commit moved fc_fill_fc_hdr() from into + * . + */ +#if defined(FC_FILL_FC_HDR_IN_SCSI_FC_ENCODE_H) #include #else -#include +#include #endif #include "fcst.h"