diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-05 00:08:44 +0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-17 21:12:32 +0400 |
commit | 7a97de82bfef5e2503223d41b79225fccd3d8d44 (patch) | |
tree | 4d4646ae5071e4e7257a9cc0460168ce4b914794 /fs | |
parent | 01b929d2c3695c500c9b1ceaff58411491b17563 (diff) |
proc: move /proc/interrupts boilerplate code to fs/proc/interrupts.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/Makefile | 1 | ||||
-rw-r--r-- | fs/proc/interrupts.c | 53 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 42 |
3 files changed, 54 insertions, 42 deletions
diff --git a/fs/proc/Makefile b/fs/proc/Makefile index 13ffa7b8d92f..b921f4475c9d 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile @@ -12,6 +12,7 @@ proc-y += inode.o root.o base.o generic.o array.o \ proc-y += cmdline.o proc-y += cpuinfo.o proc-y += devices.o +proc-y += interrupts.o proc-y += loadavg.o proc-y += meminfo.o proc-y += stat.o diff --git a/fs/proc/interrupts.c b/fs/proc/interrupts.c new file mode 100644 index 000000000000..bb492f0300d0 --- /dev/null +++ b/fs/proc/interrupts.c @@ -0,0 +1,53 @@ +#include <linux/fs.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#include <asm/irq.h> + +/* + * /proc/interrupts + */ +static void *int_seq_start(struct seq_file *f, loff_t *pos) +{ + return (*pos <= NR_IRQS) ? pos : NULL; +} + +static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) +{ + (*pos)++; + if (*pos > NR_IRQS) + return NULL; + return pos; +} + +static void int_seq_stop(struct seq_file *f, void *v) +{ + /* Nothing to do */ +} + +static const struct seq_operations int_seq_ops = { + .start = int_seq_start, + .next = int_seq_next, + .stop = int_seq_stop, + .show = show_interrupts +}; + +static int interrupts_open(struct inode *inode, struct file *filp) +{ + return seq_open(filp, &int_seq_ops); +} + +static const struct file_operations proc_interrupts_operations = { + .open = interrupts_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + +static int __init proc_interrupts_init(void) +{ + proc_create("interrupts", 0, NULL, &proc_interrupts_operations); + return 0; +} +module_init(proc_interrupts_init); diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index d49b956ce877..1b4697694078 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -197,47 +197,6 @@ static const struct file_operations proc_vmalloc_operations = { }; #endif -/* - * /proc/interrupts - */ -static void *int_seq_start(struct seq_file *f, loff_t *pos) -{ - return (*pos <= NR_IRQS) ? pos : NULL; -} - -static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) -{ - (*pos)++; - if (*pos > NR_IRQS) - return NULL; - return pos; -} - -static void int_seq_stop(struct seq_file *f, void *v) -{ - /* Nothing to do */ -} - - -static const struct seq_operations int_seq_ops = { - .start = int_seq_start, - .next = int_seq_next, - .stop = int_seq_stop, - .show = show_interrupts -}; - -static int interrupts_open(struct inode *inode, struct file *filp) -{ - return seq_open(filp, &int_seq_ops); -} - -static const struct file_operations proc_interrupts_operations = { - .open = interrupts_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - #ifdef CONFIG_PROC_PAGE_MONITOR #define KPMSIZE sizeof(u64) #define KPMMASK (KPMSIZE - 1) @@ -376,7 +335,6 @@ void __init proc_misc_init(void) proc_symlink("mounts", NULL, "self/mounts"); /* And now for trickier ones */ - proc_create("interrupts", 0, NULL, &proc_interrupts_operations); #ifdef CONFIG_SLABINFO proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); #ifdef CONFIG_DEBUG_SLAB_LEAK |