diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-04 16:08:44 -0400 |
|---|---|---|
| committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 07:15:46 -0400 |
| commit | d6917e19f3fda8e1f88bc23ddceed952927bd716 (patch) | |
| tree | b9788090ce4661f6e0339cd7b937d36ef5027b58 /fs | |
| parent | df8106dbb59a8c167ea16631059ecb5f7d77da13 (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 | 40 |
3 files changed, 54 insertions, 40 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 \ | |||
| 12 | proc-y += cmdline.o | 12 | proc-y += cmdline.o |
| 13 | proc-y += cpuinfo.o | 13 | proc-y += cpuinfo.o |
| 14 | proc-y += devices.o | 14 | proc-y += devices.o |
| 15 | proc-y += interrupts.o | ||
| 15 | proc-y += loadavg.o | 16 | proc-y += loadavg.o |
| 16 | proc-y += meminfo.o | 17 | proc-y += meminfo.o |
| 17 | proc-y += stat.o | 18 | proc-y += stat.o |
diff --git a/fs/proc/interrupts.c b/fs/proc/interrupts.c new file mode 100644 index 000000000000..05029c0e2f24 --- /dev/null +++ b/fs/proc/interrupts.c | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #include <linux/fs.h> | ||
| 2 | #include <linux/init.h> | ||
| 3 | #include <linux/interrupt.h> | ||
| 4 | #include <linux/irqnr.h> | ||
| 5 | #include <linux/proc_fs.h> | ||
| 6 | #include <linux/seq_file.h> | ||
| 7 | |||
| 8 | /* | ||
| 9 | * /proc/interrupts | ||
| 10 | */ | ||
| 11 | static void *int_seq_start(struct seq_file *f, loff_t *pos) | ||
| 12 | { | ||
| 13 | return (*pos <= nr_irqs) ? pos : NULL; | ||
| 14 | } | ||
| 15 | |||
| 16 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) | ||
| 17 | { | ||
| 18 | (*pos)++; | ||
| 19 | if (*pos > nr_irqs) | ||
| 20 | return NULL; | ||
| 21 | return pos; | ||
| 22 | } | ||
| 23 | |||
| 24 | static void int_seq_stop(struct seq_file *f, void *v) | ||
| 25 | { | ||
| 26 | /* Nothing to do */ | ||
| 27 | } | ||
| 28 | |||
| 29 | static const struct seq_operations int_seq_ops = { | ||
| 30 | .start = int_seq_start, | ||
| 31 | .next = int_seq_next, | ||
| 32 | .stop = int_seq_stop, | ||
| 33 | .show = show_interrupts | ||
| 34 | }; | ||
| 35 | |||
| 36 | static int interrupts_open(struct inode *inode, struct file *filp) | ||
| 37 | { | ||
| 38 | return seq_open(filp, &int_seq_ops); | ||
| 39 | } | ||
| 40 | |||
| 41 | static const struct file_operations proc_interrupts_operations = { | ||
| 42 | .open = interrupts_open, | ||
| 43 | .read = seq_read, | ||
| 44 | .llseek = seq_lseek, | ||
| 45 | .release = seq_release, | ||
| 46 | }; | ||
| 47 | |||
| 48 | static int __init proc_interrupts_init(void) | ||
| 49 | { | ||
| 50 | proc_create("interrupts", 0, NULL, &proc_interrupts_operations); | ||
| 51 | return 0; | ||
| 52 | } | ||
| 53 | module_init(proc_interrupts_init); | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index a87802fc9313..9e1d2684ce93 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
| @@ -198,45 +198,6 @@ static const struct file_operations proc_vmalloc_operations = { | |||
| 198 | }; | 198 | }; |
| 199 | #endif | 199 | #endif |
| 200 | 200 | ||
| 201 | /* | ||
| 202 | * /proc/interrupts | ||
| 203 | */ | ||
| 204 | static void *int_seq_start(struct seq_file *f, loff_t *pos) | ||
| 205 | { | ||
| 206 | return (*pos <= nr_irqs) ? pos : NULL; | ||
| 207 | } | ||
| 208 | |||
| 209 | |||
| 210 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) | ||
| 211 | { | ||
| 212 | (*pos)++; | ||
| 213 | return (*pos <= nr_irqs) ? pos : NULL; | ||
| 214 | } | ||
| 215 | |||
| 216 | static void int_seq_stop(struct seq_file *f, void *v) | ||
| 217 | { | ||
| 218 | /* Nothing to do */ | ||
| 219 | } | ||
| 220 | |||
| 221 | static const struct seq_operations int_seq_ops = { | ||
| 222 | .start = int_seq_start, | ||
| 223 | .next = int_seq_next, | ||
| 224 | .stop = int_seq_stop, | ||
| 225 | .show = show_interrupts | ||
| 226 | }; | ||
| 227 | |||
| 228 | static int interrupts_open(struct inode *inode, struct file *filp) | ||
| 229 | { | ||
| 230 | return seq_open(filp, &int_seq_ops); | ||
| 231 | } | ||
| 232 | |||
| 233 | static const struct file_operations proc_interrupts_operations = { | ||
| 234 | .open = interrupts_open, | ||
| 235 | .read = seq_read, | ||
| 236 | .llseek = seq_lseek, | ||
| 237 | .release = seq_release, | ||
| 238 | }; | ||
| 239 | |||
| 240 | #ifdef CONFIG_PROC_PAGE_MONITOR | 201 | #ifdef CONFIG_PROC_PAGE_MONITOR |
| 241 | #define KPMSIZE sizeof(u64) | 202 | #define KPMSIZE sizeof(u64) |
| 242 | #define KPMMASK (KPMSIZE - 1) | 203 | #define KPMMASK (KPMSIZE - 1) |
| @@ -375,7 +336,6 @@ void __init proc_misc_init(void) | |||
| 375 | proc_symlink("mounts", NULL, "self/mounts"); | 336 | proc_symlink("mounts", NULL, "self/mounts"); |
| 376 | 337 | ||
| 377 | /* And now for trickier ones */ | 338 | /* And now for trickier ones */ |
| 378 | proc_create("interrupts", 0, NULL, &proc_interrupts_operations); | ||
| 379 | #ifdef CONFIG_SLABINFO | 339 | #ifdef CONFIG_SLABINFO |
| 380 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); | 340 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); |
| 381 | #ifdef CONFIG_DEBUG_SLAB_LEAK | 341 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
