Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

module: Move modprobe_path and modules_disabled ctl_tables into the module subsys

Move module sysctl (modprobe_path and modules_disabled) out of sysctl.c
and into the modules subsystem. Make modules_disabled static as it no
longer needs to be exported. Remove module.h from the includes in sysctl
as it no longer uses any module exported variables.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Joel Granados <joel.granados@kernel.org>

+32 -25
-3
include/linux/kmod.h
··· 14 14 #include <linux/workqueue.h> 15 15 #include <linux/sysctl.h> 16 16 17 - #define KMOD_PATH_LEN 256 18 - 19 17 #ifdef CONFIG_MODULES 20 - extern char modprobe_path[]; /* for sysctl */ 21 18 /* modprobe exit status on success, -ve on error. Return value 22 19 * usually useless though. */ 23 20 extern __printf(2, 3)
-1
include/linux/module.h
··· 304 304 305 305 #ifdef CONFIG_MODULES 306 306 307 - extern int modules_disabled; /* for sysctl */ 308 307 /* Get/put a kernel symbol (calls must be symmetric) */ 309 308 void *__symbol_get(const char *symbol); 310 309 void *__symbol_get_gpl(const char *symbol);
+3
kernel/module/internal.h
··· 58 58 extern const u32 __start___kcrctab[]; 59 59 extern const u32 __start___kcrctab_gpl[]; 60 60 61 + #define KMOD_PATH_LEN 256 62 + extern char modprobe_path[]; 63 + 61 64 struct load_info { 62 65 const char *name; 63 66 /* pointer to module in temporary copy, freed at end of load_module() */
+29 -1
kernel/module/main.c
··· 126 126 } 127 127 128 128 /* Block module loading/unloading? */ 129 - int modules_disabled; 129 + static int modules_disabled; 130 130 core_param(nomodule, modules_disabled, bint, 0); 131 + 132 + static const struct ctl_table module_sysctl_table[] = { 133 + { 134 + .procname = "modprobe", 135 + .data = &modprobe_path, 136 + .maxlen = KMOD_PATH_LEN, 137 + .mode = 0644, 138 + .proc_handler = proc_dostring, 139 + }, 140 + { 141 + .procname = "modules_disabled", 142 + .data = &modules_disabled, 143 + .maxlen = sizeof(int), 144 + .mode = 0644, 145 + /* only handle a transition from default "0" to "1" */ 146 + .proc_handler = proc_dointvec_minmax, 147 + .extra1 = SYSCTL_ONE, 148 + .extra2 = SYSCTL_ONE, 149 + }, 150 + }; 151 + 152 + static int __init init_module_sysctl(void) 153 + { 154 + register_sysctl_init("kernel", module_sysctl_table); 155 + return 0; 156 + } 157 + 158 + subsys_initcall(init_module_sysctl); 131 159 132 160 /* Waiting for a module to finish initializing? */ 133 161 static DECLARE_WAIT_QUEUE_HEAD(module_wq);
-20
kernel/sysctl.c
··· 19 19 * Removed it and replaced it with older style, 03/23/00, Bill Wendling 20 20 */ 21 21 22 - #include <linux/module.h> 23 22 #include <linux/sysctl.h> 24 23 #include <linux/bitmap.h> 25 24 #include <linux/printk.h> ··· 1613 1614 .maxlen = sizeof (int), 1614 1615 .mode = 0644, 1615 1616 .proc_handler = proc_dointvec, 1616 - }, 1617 - #endif 1618 - #ifdef CONFIG_MODULES 1619 - { 1620 - .procname = "modprobe", 1621 - .data = &modprobe_path, 1622 - .maxlen = KMOD_PATH_LEN, 1623 - .mode = 0644, 1624 - .proc_handler = proc_dostring, 1625 - }, 1626 - { 1627 - .procname = "modules_disabled", 1628 - .data = &modules_disabled, 1629 - .maxlen = sizeof(int), 1630 - .mode = 0644, 1631 - /* only handle a transition from default "0" to "1" */ 1632 - .proc_handler = proc_dointvec_minmax, 1633 - .extra1 = SYSCTL_ONE, 1634 - .extra2 = SYSCTL_ONE, 1635 1617 }, 1636 1618 #endif 1637 1619 #ifdef CONFIG_UEVENT_HELPER