[patch 16/38] modules: Make struct module_layout unconditionally available

Thomas Gleixner
2022-07-16T23:18:16Z

To simplify the upcoming call thunk code it's desired to expose struct
module_layout even on !MDOULES builds. This spares conditionals and
#ifdeffery.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/module.h | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)

--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -67,6 +67,28 @@ struct module_version_attribute {
const char *version;
};

+struct mod_tree_node {
+ struct module *mod;
+ struct latch_tree_node node;
+};
+
+struct module_layout {
+ /* The actual code + data. */
+ void *base;
+ /* Total size. */
+ unsigned int size;
+ /* The size of the executable code. */
+ unsigned int text_size;
+ /* Size of RO section of the module (text+rodata) */
+ unsigned int ro_size;
+ /* Size of RO after init section */
+ unsigned int ro_after_init_size;
+
+#ifdef CONFIG_MODULES_TREE_LOOKUP
+ struct mod_tree_node mtn;
+#endif
+};
+
extern ssize_t __modver_version_show(struct module_attribute *,
struct module_kobject *, char *);

@@ -316,28 +338,6 @@ enum module_state {
MODULE_STATE_UNFORMED, /* Still setting it up. */
};

-struct mod_tree_node {
- struct module *mod;
- struct latch_tree_node node;
-};
-
-struct module_layout {
- /* The actual code + data. */
- void *base;
- /* Total size. */
- unsigned int size;
- /* The size of the executable code. */
- unsigned int text_size;
- /* Size of RO section of the module (text+rodata) */
- unsigned int ro_size;
- /* Size of RO after init section */
- unsigned int ro_after_init_size;
-
-#ifdef CONFIG_MODULES_TREE_LOOKUP
- struct mod_tree_node mtn;
-#endif
-};
-
#ifdef CONFIG_MODULES_TREE_LOOKUP
/* Only touch one cacheline for common rbtree-for-core-layout case. */
#define __module_layout_align ____cacheline_aligned