param: Fix duplicate module prefixes
PATCH 2/5 param: Fix duplicate module prefixes
Instead of insisting each new module_param sysfs entry is unique, handle the case where it already exists (for builtin modules).
The current code assumes that all identical prefixes are together in the section: true for normal uses, but not necessarily so if someone overrides MODULE_PARAM_PREFIX. More importantly, it's not true with the new "core_param()" code which uses "kernel" as a prefix.
This simplifies the caller for the builtin case, at a slight loss of efficiency (we do the lookup every time to see if the directory exists).
Signed-off-by Rusty Russell <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
--- include/linux/module.h | 2 kernel/params.c | 253 ++++++++++++++++++++++++++----------------------- 2 files changed, 138 insertions(+), 117 deletions(-)
include/linux/module.h +1 -1
@@ -59,6 +59,7 @@ struct module_kobjectstruct kobject kobj;struct module *mod;struct kobject *drivers_dir; +struct module_param_attrs *mp; };/* These are either module local, or the kernel's dummy ones. */
@@ -241,7 +242,6 @@ struct module/* Sysfs stuff. */ struct module_kobject mkobj; -struct module_param_attrs *param_attrs;struct module_attribute *modinfo_attrs;const char *version;const char *srcversion;
kernel/params.c +137 -116
336 lines not on this page · raw message