From f22d4bb63bab21968f7a52cb8b1c3df4a26439a4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 30 Nov 2019 00:54:20 +0000 Subject: [PATCH] scst, fcst, iscsi-scst, qla2x00t, srpt: Add module namespace support This patch adds support for kernel module namespaces. This patch is essential when using SCST in combination with kernel version v5.4 or later. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8673 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_scst.c | 2 ++ iscsi-scst/kernel/iscsi.c | 1 + iscsi-scst/kernel/isert-scst/isert.c | 1 + qla2x00t-32gbit/Makefile | 3 ++- qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 2 ++ qla2x00t/Makefile | 3 ++- qla2x00t/qla2x00-target/qla2x00t.c | 2 ++ scst/include/backport.h | 5 +++++ scst/src/Makefile | 3 +++ scst/src/dev_handlers/scst_cdrom.c | 1 + scst/src/dev_handlers/scst_changer.c | 1 + scst/src/dev_handlers/scst_disk.c | 2 +- scst/src/dev_handlers/scst_modisk.c | 1 + scst/src/dev_handlers/scst_processor.c | 1 + scst/src/dev_handlers/scst_raid.c | 1 + scst/src/dev_handlers/scst_tape.c | 1 + scst/src/dev_handlers/scst_user.c | 1 + scst/src/dev_handlers/scst_vdisk.c | 1 + scst_local/scst_local.c | 1 + srpt/src/ib_srpt.c | 1 + 20 files changed, 31 insertions(+), 3 deletions(-) diff --git a/fcst/ft_scst.c b/fcst/ft_scst.c index d5ff06a1c..ff2fa396a 100644 --- a/fcst/ft_scst.c +++ b/fcst/ft_scst.c @@ -85,5 +85,7 @@ static void __exit ft_module_exit(void) MODULE_AUTHOR("Joe Eykholt "); MODULE_DESCRIPTION("SCST FCoE target driver v" FT_VERSION); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(SCST); + module_init(ft_module_init); module_exit(ft_module_exit); diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 5c27259d3..dd53fb96f 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -4421,4 +4421,5 @@ module_exit(iscsi_exit); MODULE_VERSION(ISCSI_VERSION_STRING); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SCST); MODULE_DESCRIPTION("SCST iSCSI Target"); diff --git a/iscsi-scst/kernel/isert-scst/isert.c b/iscsi-scst/kernel/isert-scst/isert.c index c1b169c0c..3af86018f 100644 --- a/iscsi-scst/kernel/isert-scst/isert.c +++ b/iscsi-scst/kernel/isert-scst/isert.c @@ -514,6 +514,7 @@ out: MODULE_AUTHOR("Yan Burman"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(SCST); MODULE_DESCRIPTION("iSER target transport driver v3.0.1-pre#" __stringify(OFED_FLAVOR)); diff --git a/qla2x00t-32gbit/Makefile b/qla2x00t-32gbit/Makefile index 7ed15a9f0..cc10e4799 100644 --- a/qla2x00t-32gbit/Makefile +++ b/qla2x00t-32gbit/Makefile @@ -46,7 +46,8 @@ INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra ifneq ($(PATCHLEVEL),) ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \ - -Wno-missing-field-initializers -I$(src)/../scst/include + -Wno-missing-field-initializers -I$(src)/../scst/include\ + -DDEFAULT_SYMBOL_NAMESPACE=QLA32GB ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),) ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET) diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c index ef2b34a8d..c65ea0f49 100644 --- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c +++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c @@ -2178,4 +2178,6 @@ late_initcall(sqa_init); MODULE_DESCRIPTION("SCST Cavium adapter target interface driver."); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SCST); +MODULE_IMPORT_NS(QLA32GB); MODULE_VERSION(SQA_VERSION); diff --git a/qla2x00t/Makefile b/qla2x00t/Makefile index 814db95b7..aabec6e92 100644 --- a/qla2x00t/Makefile +++ b/qla2x00t/Makefile @@ -43,7 +43,8 @@ INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra ifneq ($(PATCHLEVEL),) ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \ - -Wno-missing-field-initializers -I$(src)/../scst/include + -Wno-missing-field-initializers -I$(src)/../scst/include\ + -DDEFAULT_SYMBOL_NAMESPACE=QLA16GB ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),) ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index e51536fdf..1c61b7890 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -7108,4 +7108,6 @@ module_exit(q2t_exit); MODULE_AUTHOR("Vladislav Bolkhovitin and others"); MODULE_DESCRIPTION("Target mode addon for qla2[2,3,4,5+]xx"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(SCST); +MODULE_IMPORT_NS(QLA16GB); MODULE_VERSION(Q2T_VERSION_STRING); diff --git a/scst/include/backport.h b/scst/include/backport.h index fca5f414e..0ece4c6b0 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -960,6 +960,11 @@ static inline void kvfree(void *addr) } #endif +/* */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) +#define MODULE_IMPORT_NS(ns) +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) && \ diff --git a/scst/src/Makefile b/scst/src/Makefile index 20ec5225e..dbf687e84 100644 --- a/scst/src/Makefile +++ b/scst/src/Makefile @@ -36,8 +36,11 @@ SHELL=/bin/bash DEV_HANDLERS_DIR = dev_handlers ifneq ($(PATCHLEVEL),) +# See also Documentation/core-api/symbol-namespaces.rst for more information +# about DEFAULT_SYMBOL_NAMESPACE. ccflags-y += -I$(KBUILD_EXTMOD)/../include $(call cc-option,-Wextra) \ -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare\ + -DDEFAULT_SYMBOL_NAMESPACE=SCST\ $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) #ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING diff --git a/scst/src/dev_handlers/scst_cdrom.c b/scst/src/dev_handlers/scst_cdrom.c index dc1eadaa2..18bd4f1bb 100644 --- a/scst/src/dev_handlers/scst_cdrom.c +++ b/scst/src/dev_handlers/scst_cdrom.c @@ -243,3 +243,4 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_DESCRIPTION("SCSI CDROM (type 5) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_changer.c b/scst/src/dev_handlers/scst_changer.c index 7ca12a9f0..53b693360 100644 --- a/scst/src/dev_handlers/scst_changer.c +++ b/scst/src/dev_handlers/scst_changer.c @@ -193,3 +193,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI medium changer (type 8) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index fcfe47b8b..cd2ab0bff 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -598,4 +598,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI disk (type 0) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); - +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_modisk.c b/scst/src/dev_handlers/scst_modisk.c index 393d526ef..d892973ae 100644 --- a/scst/src/dev_handlers/scst_modisk.c +++ b/scst/src/dev_handlers/scst_modisk.c @@ -327,3 +327,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI MO disk (type 7) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_processor.c b/scst/src/dev_handlers/scst_processor.c index db695ba9e..db259b9cd 100644 --- a/scst/src/dev_handlers/scst_processor.c +++ b/scst/src/dev_handlers/scst_processor.c @@ -193,3 +193,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI medium processor (type 3) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_raid.c b/scst/src/dev_handlers/scst_raid.c index a2e04d423..84f647a6e 100644 --- a/scst/src/dev_handlers/scst_raid.c +++ b/scst/src/dev_handlers/scst_raid.c @@ -194,3 +194,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI raid(controller) (type 0xC) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 731d67676..7c0ffd344 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -349,3 +349,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin & Leonid Stoljar"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI tape (type 1) dev handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 5a8a871be..2b54b2604 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -4260,3 +4260,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("User space device handler for SCST"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 460d3f5f3..fc5748361 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -10429,3 +10429,4 @@ MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI disk (type 0) and CDROM (type 5) dev handler for " "SCST using files on file systems or block devices"); MODULE_VERSION(SCST_VERSION_STRING); +MODULE_IMPORT_NS(SCST); diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index b88561acf..048d80a32 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -203,6 +203,7 @@ MODULE_AUTHOR("Richard Sharpe, Vladislav Bolkhovitin + ideas from SCSI_DEBUG"); MODULE_DESCRIPTION("SCSI+SCST local adapter driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(SCST_LOCAL_VERSION); +MODULE_IMPORT_NS(SCST); static int scst_local_get_sas_transport_id(struct scst_local_sess *sess, uint8_t **transport_id, int *len) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 2f127e40a..a5012e586 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -79,6 +79,7 @@ MODULE_AUTHOR("Vu Pham and Bart Van Assche"); MODULE_DESCRIPTION("SCSI RDMA Protocol target driver " "v" DRV_VERSION " (" DRV_RELDATE ")"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(SCST); /* * Global Variables