aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/ksysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ksysfs.c')
-rw-r--r--kernel/ksysfs.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 015fb69ad94d..d5eeae0fa5bc 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
18u64 uevent_seqnum;
19char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
20
18#define KERNEL_ATTR_RO(_name) \ 21#define KERNEL_ATTR_RO(_name) \
19static struct subsys_attribute _name##_attr = __ATTR_RO(_name) 22static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
20 23
@@ -23,21 +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
26static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page) 29/* current uevent sequence number */
30static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page)
27{ 31{
28 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum); 32 return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum);
29} 33}
30KERNEL_ATTR_RO(hotplug_seqnum); 34KERNEL_ATTR_RO(uevent_seqnum);
31#endif
32
33#ifdef CONFIG_KEXEC
34#include <asm/kexec.h>
35 35
36static ssize_t crash_notes_show(struct subsystem *subsys, char *page) 36/* uevent helper program, used during early boo */
37static ssize_t uevent_helper_show(struct subsystem *subsys, char *page)
37{ 38{
38 return sprintf(page, "%p\n", (void *)crash_notes); 39 return sprintf(page, "%s\n", uevent_helper);
39} 40}
40KERNEL_ATTR_RO(crash_notes); 41static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count)
42{
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;
50}
51KERNEL_ATTR_RW(uevent_helper);
41#endif 52#endif
42 53
43decl_subsys(kernel, NULL, NULL); 54decl_subsys(kernel, NULL, NULL);
@@ -45,10 +56,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys);
45 56
46static struct attribute * kernel_attrs[] = { 57static struct attribute * kernel_attrs[] = {
47#ifdef CONFIG_HOTPLUG 58#ifdef CONFIG_HOTPLUG
48 &hotplug_seqnum_attr.attr, 59 &uevent_seqnum_attr.attr,
49#endif 60 &uevent_helper_attr.attr,
50#ifdef CONFIG_KEXEC
51 &crash_notes_attr.attr,
52#endif 61#endif
53 NULL 62 NULL
54}; 63};