Commit b5aadf7f authored by Alexey Dobriyan's avatar Alexey Dobriyan

proc: move /proc/schedstat boilerplate to kernel/sched_stats.h

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
parent 3b5d5c6b
...@@ -195,9 +195,6 @@ void __init proc_misc_init(void) ...@@ -195,9 +195,6 @@ void __init proc_misc_init(void)
proc_symlink("mounts", NULL, "self/mounts"); proc_symlink("mounts", NULL, "self/mounts");
/* And now for trickier ones */ /* And now for trickier ones */
#ifdef CONFIG_SCHEDSTATS
proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
#endif
#ifdef CONFIG_PROC_KCORE #ifdef CONFIG_PROC_KCORE
proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
if (proc_root_kcore) if (proc_root_kcore)
......
...@@ -681,10 +681,6 @@ struct sched_info { ...@@ -681,10 +681,6 @@ struct sched_info {
}; };
#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
#ifdef CONFIG_SCHEDSTATS
extern const struct file_operations proc_schedstat_operations;
#endif /* CONFIG_SCHEDSTATS */
#ifdef CONFIG_TASK_DELAY_ACCT #ifdef CONFIG_TASK_DELAY_ACCT
struct task_delay_info { struct task_delay_info {
spinlock_t lock; spinlock_t lock;
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <linux/cpuset.h> #include <linux/cpuset.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
......
...@@ -90,13 +90,20 @@ static int schedstat_open(struct inode *inode, struct file *file) ...@@ -90,13 +90,20 @@ static int schedstat_open(struct inode *inode, struct file *file)
return res; return res;
} }
const struct file_operations proc_schedstat_operations = { static const struct file_operations proc_schedstat_operations = {
.open = schedstat_open, .open = schedstat_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
static int __init proc_schedstat_init(void)
{
proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
return 0;
}
module_init(proc_schedstat_init);
/* /*
* Expects runqueue lock to be held for atomicity of update * Expects runqueue lock to be held for atomicity of update
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment