diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-07-24 08:36:04 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-07-24 08:36:04 -0400 |
commit | 88bfa3247961fe5f3623f4d2cf1cd5dc72457598 (patch) | |
tree | d3ce6a00501ed34655918815623642698eece9ca /kernel/module.c | |
parent | 4befb026cf74b52fc7d382142bbfc0e9b6aab5e7 (diff) |
module: add /sys/module/<name>/uevent files
Userspace wants to manage module parameters with udev rules.
This currently only works for loaded modules, but not for
built-in ones.
To allow access to the built-in modules we need to
re-trigger all module load events that happened before any
userspace was running. We already do the same thing for all
devices, subsystems(buses) and drivers.
This adds the currently missing /sys/module/<name>/uevent files
to all module entries.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (split & trivial fix)
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index a4295e67dd83..04379f92f843 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -975,10 +975,27 @@ static struct module_attribute initstate = { | |||
975 | .show = show_initstate, | 975 | .show = show_initstate, |
976 | }; | 976 | }; |
977 | 977 | ||
978 | static ssize_t store_uevent(struct module_attribute *mattr, | ||
979 | struct module_kobject *mk, | ||
980 | const char *buffer, size_t count) | ||
981 | { | ||
982 | enum kobject_action action; | ||
983 | |||
984 | if (kobject_action_type(buffer, count, &action) == 0) | ||
985 | kobject_uevent(&mk->kobj, action); | ||
986 | return count; | ||
987 | } | ||
988 | |||
989 | struct module_attribute module_uevent = { | ||
990 | .attr = { .name = "uevent", .mode = 0200 }, | ||
991 | .store = store_uevent, | ||
992 | }; | ||
993 | |||
978 | static struct module_attribute *modinfo_attrs[] = { | 994 | static struct module_attribute *modinfo_attrs[] = { |
979 | &modinfo_version, | 995 | &modinfo_version, |
980 | &modinfo_srcversion, | 996 | &modinfo_srcversion, |
981 | &initstate, | 997 | &initstate, |
998 | &module_uevent, | ||
982 | #ifdef CONFIG_MODULE_UNLOAD | 999 | #ifdef CONFIG_MODULE_UNLOAD |
983 | &refcnt, | 1000 | &refcnt, |
984 | #endif | 1001 | #endif |