diff options
| author | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
| commit | 94bc2be31a01a3055ec94176e595dfe208e92d3b (patch) | |
| tree | ebfbe81c6718a6390bfa1b99c6d228237d818576 /kernel/ksysfs.c | |
| parent | c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4 (diff) | |
| parent | 58cba4650a7a414eabd2b40cc9d8e45fcdf192d9 (diff) | |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'kernel/ksysfs.c')
| -rw-r--r-- | kernel/ksysfs.c | 37 |
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 | ||
| 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,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 |
| 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) | ||
| 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 | } |
| 30 | KERNEL_ATTR_RO(hotplug_seqnum); | 34 | KERNEL_ATTR_RO(uevent_seqnum); |
| 31 | #endif | ||
| 32 | |||
| 33 | #ifdef CONFIG_KEXEC | ||
| 34 | #include <asm/kexec.h> | ||
| 35 | 35 | ||
| 36 | static ssize_t crash_notes_show(struct subsystem *subsys, char *page) | 36 | /* uevent helper program, used during early boo */ |
| 37 | static 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 | } |
| 40 | KERNEL_ATTR_RO(crash_notes); | 41 | static 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 | } | ||
| 51 | KERNEL_ATTR_RW(uevent_helper); | ||
| 41 | #endif | 52 | #endif |
| 42 | 53 | ||
| 43 | decl_subsys(kernel, NULL, NULL); | 54 | decl_subsys(kernel, NULL, NULL); |
| @@ -45,10 +56,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys); | |||
| 45 | 56 | ||
| 46 | static struct attribute * kernel_attrs[] = { | 57 | static 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 | }; |
