summaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-07-24 22:06:04 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-07-24 22:06:04 +0930
commit88bfa3247961fe5f3623f4d2cf1cd5dc72457598 (patch)
treed3ce6a00501ed34655918815623642698eece9ca /kernel/module.c
parent4befb026cf74b52fc7d382142bbfc0e9b6aab5e7 (diff)
downloadop-kernel-dev-88bfa3247961fe5f3623f4d2cf1cd5dc72457598.zip
op-kernel-dev-88bfa3247961fe5f3623f4d2cf1cd5dc72457598.tar.gz
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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index a4295e6..04379f92 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -975,10 +975,27 @@ static struct module_attribute initstate = {
.show = show_initstate,
};
+static ssize_t store_uevent(struct module_attribute *mattr,
+ struct module_kobject *mk,
+ const char *buffer, size_t count)
+{
+ enum kobject_action action;
+
+ if (kobject_action_type(buffer, count, &action) == 0)
+ kobject_uevent(&mk->kobj, action);
+ return count;
+}
+
+struct module_attribute module_uevent = {
+ .attr = { .name = "uevent", .mode = 0200 },
+ .store = store_uevent,
+};
+
static struct module_attribute *modinfo_attrs[] = {
&modinfo_version,
&modinfo_srcversion,
&initstate,
+ &module_uevent,
#ifdef CONFIG_MODULE_UNLOAD
&refcnt,
#endif
OpenPOWER on IntegriCloud