proc: move /proc/schedstat boilerplate to kernel/sched_stats.h
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 6 Oct 2008 09:23:43 +0000 (13:23 +0400)
committerAlexey Dobriyan <adobriyan@gmail.com>
Thu, 23 Oct 2008 14:06:12 +0000 (18:06 +0400)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
fs/proc/proc_misc.c
include/linux/sched.h
kernel/sched.c
kernel/sched_stats.h

index f6d25db989225738089a960264ed19e3a01dbd81..4a768ed5da2e6c8dd9db09a8329d1dab216c25bb 100644 (file)
@@ -195,9 +195,6 @@ void __init proc_misc_init(void)
        proc_symlink("mounts", NULL, "self/mounts");
 
        /* And now for trickier ones */
-#ifdef CONFIG_SCHEDSTATS
-       proc_create("schedstat", 0, NULL, &proc_schedstat_operations);
-#endif
 #ifdef CONFIG_PROC_KCORE
        proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
        if (proc_root_kcore)
index 5c38db536e07f8b7b0d6e5b0dc4f31a9e3cb07c1..7f60cb9b53cb99aa1063de3fe3d8240a407878a4 100644 (file)
@@ -681,10 +681,6 @@ struct sched_info {
 };
 #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
 struct task_delay_info {
        spinlock_t      lock;
index d906f72b42d23ae1d8c2355d9b605e5fd0761eaa..5a70189d50519b828b1c95c28b5598df342aa556 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/cpuset.h>
 #include <linux/percpu.h>
 #include <linux/kthread.h>
+#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/sysctl.h>
 #include <linux/syscalls.h>
index b8c156979cf2ad600b0f9b59f9a935cec86aab85..3d14ce2739023d582aef9bd2f8575eb53b84a1e0 100644 (file)
@@ -90,13 +90,20 @@ static int schedstat_open(struct inode *inode, struct file *file)
        return res;
 }
 
-const struct file_operations proc_schedstat_operations = {
+static const struct file_operations proc_schedstat_operations = {
        .open    = schedstat_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
        .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
  */