module: Move sysfs support into a separate file
Subsystems (3)
PATCH v6 11/13 module: Move sysfs support into a separate file
No functional change.
This patch migrates module sysfs support out of core code into kernel/module/sysfs.c. In addition simple code refactoring to make this possible.
--- kernel/module/Makefile | 1 + kernel/module/internal.h | 21 ++ kernel/module/main.c | 469 +-------------------------------------- kernel/module/sysfs.c | 436 ++++++++++++++++++++++++++++++++++++ 4 files changed, 461 insertions(+), 466 deletions(-) create mode 100644 kernel/module/sysfs.c
kernel/module/Makefile +1 -0
@@ -14,4 +14,5 @@ obj-$(CONFIG_STRICT_MODULE_RWX) += strict_rwx.o obj-$(CONFIG_DEBUG_KMEMLEAK) += debug_kmemleak.o obj-$(CONFIG_KALLSYMS) += kallsyms.o obj-$(CONFIG_PROC_FS) += procfs.o +obj-$(CONFIG_SYSFS) += sysfs.o endif
kernel/module/internal.h +21 -0
@@ -34,6 +34,9 @@extern struct mutex module_mutex;extern struct list_head modules; +extern struct module_attribute *modinfo_attrs[]; +extern size_t modinfo_attrs_count; +/* Provided by the linker */ extern const struct kernel_symbol __start___ksymtab[];extern const struct kernel_symbol __stop___ksymtab[];
@@ -213,3 +216,21 @@ static inline bool sect_empty(const Elf_Shdr *sect)static inline void layout_symtab (struct module *mod,struct load_info *info) { }static inline void add_kallsyms (struct module *mod,const struct load_info *info) { }#endif /* CONFIG_KALLSYMS */ + +#ifdef CONFIG_SYSFS +int mod_sysfs_setup (struct module *mod,const struct load_info *info, +struct kernel_param *kparam,unsigned int num_params); +void mod_sysfs_teardown (struct module *mod); +void init_param_lock (struct module *mod); +#else /* !CONFIG_SYSFS */ +static inline int mod_sysfs_setup (struct module *mod, +const struct load_info *info, +struct kernel_param *kparam, +unsigned int num_params) +{ +return 0 ; +} + +static inline void mod_sysfs_teardown (struct module *mod) { } +static inline void init_param_lock (struct module *mod) { } +#endif /* CONFIG_SYSFS */
kernel/module/main.c +3 -466
494 lines not on this page · raw message
kernel/module/sysfs.c new file +436 -0
436 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v6 12/13 module: Move kdb_modules list out of core code
No functional change.
This patch migrates kdb_modules list to core kdb code since the list of added/or loaded modules is no longer private.
--- kernel/debug/kdb/kdb_main.c | 5 +++++ kernel/debug/kdb/kdb_private.h | 4 ---- kernel/module/main.c | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-)
kernel/debug/kdb/kdb_main.c +5 -0
@@ -59,6 +59,11 @@ EXPORT_SYMBOL(kdb_grepping_flag);int kdb_grep_leading;int kdb_grep_trailing; +#ifdef CONFIG_MODULES +extern struct list_head modules; +static struct list_head *kdb_modules = &modules;/* kdb needs the list of modules */ +#endif /* CONFIG_MODULES */ +/* * Kernel debugger state flags */
kernel/debug/kdb/kdb_private.h +0 -4
@@ -226,10 +226,6 @@ extern void kdb_kbd_cleanup_state(void);#define kdb_kbd_cleanup_state ()#endif /* ! CONFIG_KDB_KEYBOARD */ -#ifdef CONFIG_MODULES -extern struct list_head *kdb_modules; -#endif /* CONFIG_MODULES */ -extern char kdb_prompt_str[];#define KDB_WORD_SIZE ((int)sizeof(unsigned long))
kernel/module/main.c +0 -4
@@ -108,10 +108,6 @@ static void mod_update_bounds(struct module *mod)__mod_update_bounds (mod->init_layout.base, mod->init_layout.size); } -#ifdef CONFIG_KGDB_KDB -struct list_head *kdb_modules = &modules;/* kdb needs the list of modules */ -#endif /* CONFIG_KGDB_KDB */ -static void module_assert_mutex_or_preempt (void ) {#ifdef CONFIG_LOCKDEP
Signature · 1 line
2.34.1
PATCH v6 13/13 module: Move version support into a separate file
In reply to Aaron TomlinNo functional change.
This patch migrates module version support out of core code into kernel/module/version.c. In addition simple code refactoring to make this possible.
--- kernel/module/Makefile | 1 + kernel/module/internal.h | 48 ++++++++++++ kernel/module/main.c | 156 ++------------------------------------- kernel/module/version.c | 109 +++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 148 deletions(-) create mode 100644 kernel/module/version.c
kernel/module/Makefile +1 -0
@@ -15,4 +15,5 @@ obj-$(CONFIG_DEBUG_KMEMLEAK) += debug_kmemleak.o obj-$(CONFIG_KALLSYMS) += kallsyms.o obj-$(CONFIG_PROC_FS) += procfs.o obj-$(CONFIG_SYSFS) += sysfs.o +obj-$(CONFIG_MODVERSIONS) += version.o endif
kernel/module/internal.h +48 -0
58 lines not on this page · raw message
kernel/module/main.c +8 -148
189 lines not on this page · raw message
kernel/module/version.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.34.1
Miroslav Benes
maintainerQuoted 7 lines · Aaron Tomlin
No functional change.
This patch migrates module sysfs support out of core code into
kernel/module/sysfs.c. In addition simple code refactoring to make this possible.Signed-off-by Aaron Tomlin <[email protected]>
There was apparently a problem on your side when sending the series. There is Reply-To field which probably should have been In-Reply-To. It also applied to the following two patches.
Quoted 36 lines
kernel/module/Makefile | 1 + kernel/module/internal.h | 21 ++ kernel/module/main.c | 469 +-------------------------------------- kernel/module/sysfs.c | 436 ++++++++++++++++++++++++++++++++++++ 4 files changed, 461 insertions(+), 466 deletions(-) create mode 100644 kernel/module/sysfs.ckernel/module/Makefile +1
-0@@ -14,4 +14,5 @@ obj-$(CONFIG_STRICT_MODULE_RWX) += strict_rwx.o obj-$(CONFIG_DEBUG_KMEMLEAK) += debug_kmemleak.o obj-$(CONFIG_KALLSYMS) += kallsyms.o obj-$(CONFIG_PROC_FS) += procfs.o +obj-$(CONFIG_SYSFS) += sysfs.o endifkernel/module/internal.h +4
-0@@ -34,6 +34,9 @@extern struct mutex module_mutex;extern struct list_head modules; +extern struct module_attribute *modinfo_attrs[]; +extern size_t modinfo_attrs_count; +/* Provided by the linker */ extern const struct kernel_symbol __start___ksymtab[];extern const struct kernel_symbol __stop___ksymtab[];@@ -213,3 +216,21 @@ static inline bool sect_empty(const Elf_Shdr *sect)static inline void layout_symtab (struct module *mod,struct load_info *info) { }static inline void add_kallsyms (struct module *mod,const struct load_info *info) { }#endif /* CONFIG_KALLSYMS */ +
kernel/module/internal.h static inline bool sect_empty(const Elf_Shdr *sect) · line 229
Quoted 10 lines
kernel/module/internal.h +10
-0+#ifdef CONFIG_SYSFS +int mod_sysfs_setup (struct module *mod,const struct load_info *info, +struct kernel_param *kparam,unsigned int num_params); +void mod_sysfs_teardown (struct module *mod); +void init_param_lock (struct module *mod); +#else /* !CONFIG_SYSFS */ +static inline int mod_sysfs_setup (struct module *mod, +const struct load_info *info, +struct kernel_param *kparam, +unsigned int num_params)
Whitespace is broken here.
Miroslav