Release 4.7 kernel/ksysfs.c
/*
* kernel/ksysfs.c - sysfs attributes in /sys/kernel, which
* are not related to any other subsystem
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This file is release under the GPLv2
*
*/
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/kexec.h>
#include <linux/profile.h>
#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/capability.h>
#include <linux/compiler.h>
#include <linux/rcupdate.h> /* rcu_expedited and rcu_normal */
#define KERNEL_ATTR_RO(_name) \
static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
#define KERNEL_ATTR_RW(_name) \
static struct kobj_attribute _name##_attr = \
__ATTR(_name, 0644, _name##_show, _name##_store)
/* current uevent sequence number */
static ssize_t uevent_seqnum_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kay sievers | kay sievers | 29 | 82.86% | 4 | 66.67% |
andrew morton | andrew morton | 5 | 14.29% | 1 | 16.67% |
greg kroah-hartman | greg kroah-hartman | 1 | 2.86% | 1 | 16.67% |
| Total | 35 | 100.00% | 6 | 100.00% |
KERNEL_ATTR_RO(uevent_seqnum);
#ifdef CONFIG_UEVENT_HELPER
/* uevent helper program, used during early boot */
static ssize_t uevent_helper_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", uevent_helper);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kay sievers | kay sievers | 30 | 100.00% | 3 | 100.00% |
| Total | 30 | 100.00% | 3 | 100.00% |
static ssize_t uevent_helper_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
if (count+1 > UEVENT_HELPER_PATH_LEN)
return -ENOENT;
memcpy(uevent_helper, buf, count);
uevent_helper[count] = '\0';
if (count && uevent_helper[count-1] == '\n')
uevent_helper[count-1] = '\0';
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kay sievers | kay sievers | 77 | 100.00% | 3 | 100.00% |
| Total | 77 | 100.00% | 3 | 100.00% |
KERNEL_ATTR_RW(uevent_helper);
#endif
#ifdef CONFIG_PROFILING
static ssize_t profiling_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", prof_on);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave hansen | dave hansen | 30 | 100.00% | 1 | 100.00% |
| Total | 30 | 100.00% | 1 | 100.00% |
static ssize_t profiling_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
int ret;
if (prof_on)
return -EEXIST;
/*
* This eventually calls into get_option() which
* has a ton of callers and is not const. It is
* easiest to cast it away here.
*/
profile_setup((char *)buf);
ret = profile_init();
if (ret)
return ret;
ret = create_proc_profile();
if (ret)
return ret;
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave hansen | dave hansen | 72 | 100.00% | 1 | 100.00% |
| Total | 72 | 100.00% | 1 | 100.00% |
KERNEL_ATTR_RW(profiling);
#endif
#ifdef CONFIG_KEXEC_CORE
static ssize_t kexec_loaded_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", !!kexec_image);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
jeff moyer | jeff moyer | 23 | 71.88% | 1 | 50.00% |
kay sievers | kay sievers | 9 | 28.12% | 1 | 50.00% |
| Total | 32 | 100.00% | 2 | 100.00% |
KERNEL_ATTR_RO(kexec_loaded);
static ssize_t kexec_crash_loaded_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", !!kexec_crash_image);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
jeff moyer | jeff moyer | 23 | 71.88% | 1 | 50.00% |
kay sievers | kay sievers | 9 | 28.12% | 1 | 50.00% |
| Total | 32 | 100.00% | 2 | 100.00% |
KERNEL_ATTR_RO(kexec_crash_loaded);
static ssize_t kexec_crash_size_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%zu\n", crash_get_memory_size());
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
americo wang | americo wang | 31 | 100.00% | 1 | 100.00% |
| Total | 31 | 100.00% | 1 | 100.00% |
static ssize_t kexec_crash_size_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
unsigned long cnt;
int ret;
if (kstrtoul(buf, 0, &cnt))
return -EINVAL;
ret = crash_shrink_memory(cnt);
return ret < 0 ? ret : count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
americo wang | americo wang | 62 | 98.41% | 1 | 50.00% |
jingoo han | jingoo han | 1 | 1.59% | 1 | 50.00% |
| Total | 63 | 100.00% | 2 | 100.00% |
KERNEL_ATTR_RW(kexec_crash_size);
static ssize_t vmcoreinfo_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%lx %x\n",
paddr_vmcoreinfo_note(),
(unsigned int)sizeof(vmcoreinfo_note));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ken'ichi ohmichi | ken'ichi ohmichi | 27 | 67.50% | 2 | 50.00% |
kay sievers | kay sievers | 9 | 22.50% | 1 | 25.00% |
vivek goyal | vivek goyal | 4 | 10.00% | 1 | 25.00% |
| Total | 40 | 100.00% | 4 | 100.00% |
KERNEL_ATTR_RO(vmcoreinfo);
#endif /* CONFIG_KEXEC_CORE */
/* whether file capabilities are enabled */
static ssize_t fscaps_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", file_caps_enabled);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ludwig nussel | ludwig nussel | 30 | 100.00% | 1 | 100.00% |
| Total | 30 | 100.00% | 1 | 100.00% |
KERNEL_ATTR_RO(fscaps);
#ifndef CONFIG_TINY_RCU
int rcu_expedited;
static ssize_t rcu_expedited_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", READ_ONCE(rcu_expedited));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
antti p miettinen | antti p miettinen | 30 | 90.91% | 1 | 50.00% |
paul e. mckenney | paul e. mckenney | 3 | 9.09% | 1 | 50.00% |
| Total | 33 | 100.00% | 2 | 100.00% |
static ssize_t rcu_expedited_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
if (kstrtoint(buf, 0, &rcu_expedited))
return -EINVAL;
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
antti p miettinen | antti p miettinen | 43 | 100.00% | 1 | 100.00% |
| Total | 43 | 100.00% | 1 | 100.00% |
KERNEL_ATTR_RW(rcu_expedited);
int rcu_normal;
static ssize_t rcu_normal_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", READ_ONCE(rcu_normal));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
paul e. mckenney | paul e. mckenney | 33 | 100.00% | 1 | 100.00% |
| Total | 33 | 100.00% | 1 | 100.00% |
static ssize_t rcu_normal_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
if (kstrtoint(buf, 0, &rcu_normal))
return -EINVAL;
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
paul e. mckenney | paul e. mckenney | 43 | 100.00% | 1 | 100.00% |
| Total | 43 | 100.00% | 1 | 100.00% |
KERNEL_ATTR_RW(rcu_normal);
#endif /* #ifndef CONFIG_TINY_RCU */
/*
* Make /sys/kernel/notes give the raw contents of our kernel .notes section.
*/
extern const void __start_notes __weak;
extern const void __stop_notes __weak;
#define notes_size (&__stop_notes - &__start_notes)
static ssize_t notes_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
memcpy(buf, &__start_notes + off, count);
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
roland mcgrath | roland mcgrath | 41 | 89.13% | 1 | 50.00% |
chris wright | chris wright | 5 | 10.87% | 1 | 50.00% |
| Total | 46 | 100.00% | 2 | 100.00% |
static struct bin_attribute notes_attr = {
.attr = {
.name = "notes",
.mode = S_IRUGO,
},
.read = ¬es_read,
};
struct kobject *kernel_kobj;
EXPORT_SYMBOL_GPL(kernel_kobj);
static struct attribute * kernel_attrs[] = {
&fscaps_attr.attr,
&uevent_seqnum_attr.attr,
#ifdef CONFIG_UEVENT_HELPER
&uevent_helper_attr.attr,
#endif
#ifdef CONFIG_PROFILING
&profiling_attr.attr,
#endif
#ifdef CONFIG_KEXEC_CORE
&kexec_loaded_attr.attr,
&kexec_crash_loaded_attr.attr,
&kexec_crash_size_attr.attr,
&vmcoreinfo_attr.attr,
#endif
#ifndef CONFIG_TINY_RCU
&rcu_expedited_attr.attr,
&rcu_normal_attr.attr,
#endif
NULL
};
static struct attribute_group kernel_attr_group = {
.attrs = kernel_attrs,
};
static int __init ksysfs_init(void)
{
int error;
kernel_kobj = kobject_create_and_add("kernel", NULL);
if (!kernel_kobj) {
error = -ENOMEM;
goto exit;
}
error = sysfs_create_group(kernel_kobj, &kernel_attr_group);
if (error)
goto kset_exit;
if (notes_size > 0) {
notes_attr.size = notes_size;
error = sysfs_create_bin_file(kernel_kobj, ¬es_attr);
if (error)
goto group_exit;
}
return 0;
group_exit:
sysfs_remove_group(kernel_kobj, &kernel_attr_group);
kset_exit:
kobject_put(kernel_kobj);
exit:
return error;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
greg kroah-hartman | greg kroah-hartman | 53 | 48.62% | 3 | 50.00% |
kay sievers | kay sievers | 29 | 26.61% | 1 | 16.67% |
roland mcgrath | roland mcgrath | 23 | 21.10% | 1 | 16.67% |
dhaval giani | dhaval giani | 4 | 3.67% | 1 | 16.67% |
| Total | 109 | 100.00% | 6 | 100.00% |
core_initcall(ksysfs_init);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kay sievers | kay sievers | 272 | 25.49% | 4 | 12.12% |
dave hansen | dave hansen | 125 | 11.72% | 1 | 3.03% |
roland mcgrath | roland mcgrath | 105 | 9.84% | 1 | 3.03% |
paul e. mckenney | paul e. mckenney | 104 | 9.75% | 2 | 6.06% |
americo wang | americo wang | 103 | 9.65% | 1 | 3.03% |
antti p miettinen | antti p miettinen | 86 | 8.06% | 1 | 3.03% |
jeff moyer | jeff moyer | 76 | 7.12% | 1 | 3.03% |
greg kroah-hartman | greg kroah-hartman | 65 | 6.09% | 6 | 18.18% |
ludwig nussel | ludwig nussel | 44 | 4.12% | 1 | 3.03% |
ken'ichi ohmichi | ken'ichi ohmichi | 37 | 3.47% | 2 | 6.06% |
michael marineau | michael marineau | 10 | 0.94% | 1 | 3.03% |
dhaval giani | dhaval giani | 7 | 0.66% | 1 | 3.03% |
paul gortmaker | paul gortmaker | 7 | 0.66% | 3 | 9.09% |
andrew morton | andrew morton | 5 | 0.47% | 1 | 3.03% |
chris wright | chris wright | 5 | 0.47% | 1 | 3.03% |
gideon israel dsouza | gideon israel dsouza | 5 | 0.47% | 1 | 3.03% |
vivek goyal | vivek goyal | 4 | 0.37% | 1 | 3.03% |
dave young | dave young | 3 | 0.28% | 1 | 3.03% |
david howells | david howells | 2 | 0.19% | 1 | 3.03% |
jingoo han | jingoo han | 1 | 0.09% | 1 | 3.03% |
thadeu lima de souza cascardo | thadeu lima de souza cascardo | 1 | 0.09% | 1 | 3.03% |
| Total | 1067 | 100.00% | 33 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.