aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ksysfs.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 015fb69ad94d..e975a76a9d5b 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -23,11 +23,29 @@ static struct subsys_attribute _name##_attr = \
23 __ATTR(_name, 0644, _name##_show, _name##_store) 23 __ATTR(_name, 0644, _name##_show, _name##_store)
24 24
25#ifdef CONFIG_HOTPLUG 25#ifdef CONFIG_HOTPLUG
26static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page) 26/* current uevent sequence number */
27static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page)
27{ 28{
28 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum); 29 return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
29} 30}
30KERNEL_ATTR_RO(hotplug_seqnum); 31KERNEL_ATTR_RO(uevent_seqnum);
32
33/* uevent helper program, used during early boo */
34static ssize_t uevent_helper_show(struct subsystem *subsys, char *page)
35{
36 return sprintf(page, "%s\n", hotplug_path);
37}
38static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count)
39{
40 if (count+1 > HOTPLUG_PATH_LEN)
41 return -ENOENT;
42 memcpy(hotplug_path, page, count);
43 hotplug_path[count] = '\0';
44 if (count && hotplug_path[count-1] == '\n')
45 hotplug_path[count-1] = '\0';
46 return count;
47}
48KERNEL_ATTR_RW(uevent_helper);
31#endif 49#endif
32 50
33#ifdef CONFIG_KEXEC 51#ifdef CONFIG_KEXEC
@@ -45,7 +63,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys);
45 63
46static struct attribute * kernel_attrs[] = { 64static struct attribute * kernel_attrs[] = {
47#ifdef CONFIG_HOTPLUG 65#ifdef CONFIG_HOTPLUG
48 &hotplug_seqnum_attr.attr, 66 &uevent_seqnum_attr.attr,
67 &uevent_helper_attr.attr,
49#endif 68#endif
50#ifdef CONFIG_KEXEC 69#ifdef CONFIG_KEXEC
51 &crash_notes_attr.attr, 70 &crash_notes_attr.attr,