diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ksysfs.c | 30 | ||||
-rw-r--r-- | kernel/sysctl.c | 8 |
2 files changed, 29 insertions, 9 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 015fb69ad94d..99af8b05eeaa 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -15,6 +15,9 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | 17 | ||
18 | u64 uevent_seqnum; | ||
19 | char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug"; | ||
20 | |||
18 | #define KERNEL_ATTR_RO(_name) \ | 21 | #define KERNEL_ATTR_RO(_name) \ |
19 | static struct subsys_attribute _name##_attr = __ATTR_RO(_name) | 22 | static struct subsys_attribute _name##_attr = __ATTR_RO(_name) |
20 | 23 | ||
@@ -23,11 +26,29 @@ static struct subsys_attribute _name##_attr = \ | |||
23 | __ATTR(_name, 0644, _name##_show, _name##_store) | 26 | __ATTR(_name, 0644, _name##_show, _name##_store) |
24 | 27 | ||
25 | #ifdef CONFIG_HOTPLUG | 28 | #ifdef CONFIG_HOTPLUG |
26 | static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page) | 29 | /* current uevent sequence number */ |
30 | static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page) | ||
31 | { | ||
32 | return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); | ||
33 | } | ||
34 | KERNEL_ATTR_RO(uevent_seqnum); | ||
35 | |||
36 | /* uevent helper program, used during early boo */ | ||
37 | static ssize_t uevent_helper_show(struct subsystem *subsys, char *page) | ||
38 | { | ||
39 | return sprintf(page, "%s\n", uevent_helper); | ||
40 | } | ||
41 | static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count) | ||
27 | { | 42 | { |
28 | return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum); | 43 | if (count+1 > UEVENT_HELPER_PATH_LEN) |
44 | return -ENOENT; | ||
45 | memcpy(uevent_helper, page, count); | ||
46 | uevent_helper[count] = '\0'; | ||
47 | if (count && uevent_helper[count-1] == '\n') | ||
48 | uevent_helper[count-1] = '\0'; | ||
49 | return count; | ||
29 | } | 50 | } |
30 | KERNEL_ATTR_RO(hotplug_seqnum); | 51 | KERNEL_ATTR_RW(uevent_helper); |
31 | #endif | 52 | #endif |
32 | 53 | ||
33 | #ifdef CONFIG_KEXEC | 54 | #ifdef CONFIG_KEXEC |
@@ -45,7 +66,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys); | |||
45 | 66 | ||
46 | static struct attribute * kernel_attrs[] = { | 67 | static struct attribute * kernel_attrs[] = { |
47 | #ifdef CONFIG_HOTPLUG | 68 | #ifdef CONFIG_HOTPLUG |
48 | &hotplug_seqnum_attr.attr, | 69 | &uevent_seqnum_attr.attr, |
70 | &uevent_helper_attr.attr, | ||
49 | #endif | 71 | #endif |
50 | #ifdef CONFIG_KEXEC | 72 | #ifdef CONFIG_KEXEC |
51 | &crash_notes_attr.attr, | 73 | &crash_notes_attr.attr, |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b53115b882e1..345f4a1d533f 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/kobject.h> | ||
34 | #include <linux/net.h> | 35 | #include <linux/net.h> |
35 | #include <linux/sysrq.h> | 36 | #include <linux/sysrq.h> |
36 | #include <linux/highuid.h> | 37 | #include <linux/highuid.h> |
@@ -83,9 +84,6 @@ static int ngroups_max = NGROUPS_MAX; | |||
83 | #ifdef CONFIG_KMOD | 84 | #ifdef CONFIG_KMOD |
84 | extern char modprobe_path[]; | 85 | extern char modprobe_path[]; |
85 | #endif | 86 | #endif |
86 | #ifdef CONFIG_HOTPLUG | ||
87 | extern char hotplug_path[]; | ||
88 | #endif | ||
89 | #ifdef CONFIG_CHR_DEV_SG | 87 | #ifdef CONFIG_CHR_DEV_SG |
90 | extern int sg_big_buff; | 88 | extern int sg_big_buff; |
91 | #endif | 89 | #endif |
@@ -397,8 +395,8 @@ static ctl_table kern_table[] = { | |||
397 | { | 395 | { |
398 | .ctl_name = KERN_HOTPLUG, | 396 | .ctl_name = KERN_HOTPLUG, |
399 | .procname = "hotplug", | 397 | .procname = "hotplug", |
400 | .data = &hotplug_path, | 398 | .data = &uevent_helper, |
401 | .maxlen = HOTPLUG_PATH_LEN, | 399 | .maxlen = UEVENT_HELPER_PATH_LEN, |
402 | .mode = 0644, | 400 | .mode = 0644, |
403 | .proc_handler = &proc_dostring, | 401 | .proc_handler = &proc_dostring, |
404 | .strategy = &sysctl_string, | 402 | .strategy = &sysctl_string, |