Skip to content

Commit 44c0953

Browse files
Aaron Tomlinmcgrof
authored andcommitted
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. Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 0ffc40f commit 44c0953

4 files changed

Lines changed: 461 additions & 466 deletions

File tree

kernel/module/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ obj-$(CONFIG_STRICT_MODULE_RWX) += strict_rwx.o
1616
obj-$(CONFIG_DEBUG_KMEMLEAK) += debug_kmemleak.o
1717
obj-$(CONFIG_KALLSYMS) += kallsyms.o
1818
obj-$(CONFIG_PROC_FS) += procfs.o
19+
obj-$(CONFIG_SYSFS) += sysfs.o

kernel/module/internal.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
extern struct mutex module_mutex;
3535
extern struct list_head modules;
3636

37+
extern struct module_attribute *modinfo_attrs[];
38+
extern size_t modinfo_attrs_count;
39+
3740
/* Provided by the linker */
3841
extern const struct kernel_symbol __start___ksymtab[];
3942
extern const struct kernel_symbol __stop___ksymtab[];
@@ -204,3 +207,21 @@ static inline void init_build_id(struct module *mod, const struct load_info *inf
204207
static inline void layout_symtab(struct module *mod, struct load_info *info) { }
205208
static inline void add_kallsyms(struct module *mod, const struct load_info *info) { }
206209
#endif /* CONFIG_KALLSYMS */
210+
211+
#ifdef CONFIG_SYSFS
212+
int mod_sysfs_setup(struct module *mod, const struct load_info *info,
213+
struct kernel_param *kparam, unsigned int num_params);
214+
void mod_sysfs_teardown(struct module *mod);
215+
void init_param_lock(struct module *mod);
216+
#else /* !CONFIG_SYSFS */
217+
static inline int mod_sysfs_setup(struct module *mod,
218+
const struct load_info *info,
219+
struct kernel_param *kparam,
220+
unsigned int num_params)
221+
{
222+
return 0;
223+
}
224+
225+
static inline void mod_sysfs_teardown(struct module *mod) { }
226+
static inline void init_param_lock(struct module *mod) { }
227+
#endif /* CONFIG_SYSFS */

0 commit comments

Comments
 (0)