Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

proc: move /proc/interrupts boilerplate code to fs/proc/interrupts.c

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

+54 -40
+1
fs/proc/Makefile
··· 12 12 proc-y += cmdline.o 13 13 proc-y += cpuinfo.o 14 14 proc-y += devices.o 15 + proc-y += interrupts.o 15 16 proc-y += loadavg.o 16 17 proc-y += meminfo.o 17 18 proc-y += stat.o
+53
fs/proc/interrupts.c
··· 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);
-40
fs/proc/proc_misc.c
··· 198 198 }; 199 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 201 #ifdef CONFIG_PROC_PAGE_MONITOR 241 202 #define KPMSIZE sizeof(u64) 242 203 #define KPMMASK (KPMSIZE - 1) ··· 336 375 proc_symlink("mounts", NULL, "self/mounts"); 337 376 338 377 /* And now for trickier ones */ 339 - proc_create("interrupts", 0, NULL, &proc_interrupts_operations); 340 378 #ifdef CONFIG_SLABINFO 341 379 proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); 342 380 #ifdef CONFIG_DEBUG_SLAB_LEAK