diff options
Diffstat (limited to 'kernel/ksysfs.c')
| -rw-r--r-- | kernel/ksysfs.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index e53bc30e9ba5..08dd8ed86c77 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/kexec.h> | 16 | #include <linux/kexec.h> |
| 17 | #include <linux/profile.h> | ||
| 17 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
| 18 | 19 | ||
| 19 | #define KERNEL_ATTR_RO(_name) \ | 20 | #define KERNEL_ATTR_RO(_name) \ |
| @@ -53,6 +54,37 @@ static ssize_t uevent_helper_store(struct kobject *kobj, | |||
| 53 | KERNEL_ATTR_RW(uevent_helper); | 54 | KERNEL_ATTR_RW(uevent_helper); |
| 54 | #endif | 55 | #endif |
| 55 | 56 | ||
| 57 | #ifdef CONFIG_PROFILING | ||
| 58 | static ssize_t profiling_show(struct kobject *kobj, | ||
| 59 | struct kobj_attribute *attr, char *buf) | ||
| 60 | { | ||
| 61 | return sprintf(buf, "%d\n", prof_on); | ||
| 62 | } | ||
| 63 | static ssize_t profiling_store(struct kobject *kobj, | ||
| 64 | struct kobj_attribute *attr, | ||
| 65 | const char *buf, size_t count) | ||
| 66 | { | ||
| 67 | int ret; | ||
| 68 | |||
| 69 | if (prof_on) | ||
| 70 | return -EEXIST; | ||
| 71 | /* | ||
| 72 | * This eventually calls into get_option() which | ||
| 73 | * has a ton of callers and is not const. It is | ||
| 74 | * easiest to cast it away here. | ||
| 75 | */ | ||
| 76 | profile_setup((char *)buf); | ||
| 77 | ret = profile_init(); | ||
| 78 | if (ret) | ||
| 79 | return ret; | ||
| 80 | ret = create_proc_profile(); | ||
| 81 | if (ret) | ||
| 82 | return ret; | ||
| 83 | return count; | ||
| 84 | } | ||
| 85 | KERNEL_ATTR_RW(profiling); | ||
| 86 | #endif | ||
| 87 | |||
| 56 | #ifdef CONFIG_KEXEC | 88 | #ifdef CONFIG_KEXEC |
| 57 | static ssize_t kexec_loaded_show(struct kobject *kobj, | 89 | static ssize_t kexec_loaded_show(struct kobject *kobj, |
| 58 | struct kobj_attribute *attr, char *buf) | 90 | struct kobj_attribute *attr, char *buf) |
| @@ -109,6 +141,9 @@ static struct attribute * kernel_attrs[] = { | |||
| 109 | &uevent_seqnum_attr.attr, | 141 | &uevent_seqnum_attr.attr, |
| 110 | &uevent_helper_attr.attr, | 142 | &uevent_helper_attr.attr, |
| 111 | #endif | 143 | #endif |
| 144 | #ifdef CONFIG_PROFILING | ||
| 145 | &profiling_attr.attr, | ||
| 146 | #endif | ||
| 112 | #ifdef CONFIG_KEXEC | 147 | #ifdef CONFIG_KEXEC |
| 113 | &kexec_loaded_attr.attr, | 148 | &kexec_loaded_attr.attr, |
| 114 | &kexec_crash_loaded_attr.attr, | 149 | &kexec_crash_loaded_attr.attr, |
