[PATCH 21/75] backports: add module namespace support

Hauke Mehrtens <[email protected]> Fri, 28 Jun 2024 01:47:07 +0200
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
From: Johannes Berg <[email protected]>

Add EXPORT_SYMBOL_NS_GPL() and MODULE_IMPORT_NS(),
for kernels that don't yet know about it. Just do
nothing about namespaces in that case, of course.

Signed-off-by: Johannes Berg <[email protected]>
---
 backport/backport-include/linux/export.h | 12 ++++++++++++
 backport/backport-include/linux/module.h |  4 ++++
 2 files changed, 16 insertions(+)
 create mode 100644 backport/backport-include/linux/export.h

diff --git a/backport/backport-include/linux/export.h b/backport/backport-include/linux/export.h
new file mode 100644
index 00000000..c24c9f99
--- /dev/null
+++ b/backport/backport-include/linux/export.h
@@ -0,0 +1,12 @@
+#ifndef _COMPAT_LINUX_EXPORT_H
+#define _COMPAT_LINUX_EXPORT_H 1
+
+#include <linux/version.h>
+
+#include_next <linux/export.h>
+
+#ifndef EXPORT_SYMBOL_NS_GPL
+#define EXPORT_SYMBOL_NS_GPL(sym, ns) EXPORT_SYMBOL_GPL(sym)
+#endif
+
+#endif /* _COMPAT_LINUX_EXPORT_H */
diff --git a/backport/backport-include/linux/module.h b/backport/backport-include/linux/module.h
index efe970f1..b93a56d9 100644
--- a/backport/backport-include/linux/module.h
+++ b/backport/backport-include/linux/module.h
@@ -67,4 +67,8 @@ extern void backport_dependency_symbol(void);
 	__CFI_ADDRESSABLE(cleanup_module, __exitdata);
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,4,0)
+#define MODULE_IMPORT_NS(ns)
+#endif
+
 #endif /* __BACKPORT_LINUX_MODULE_H */
-- 
2.45.2