LCOV - code coverage report
Current view: top level - fs/proc - interrupts.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 12 50.0 %
Date: 2014-02-18 Functions: 4 5 80.0 %
Branches: 3 4 75.0 %

           Branch data     Line data    Source code
       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                 :          0 : static void *int_seq_start(struct seq_file *f, loff_t *pos)
      12                 :            : {
      13         [ +  + ]:          3 :         return (*pos <= nr_irqs) ? pos : NULL;
      14                 :            : }
      15                 :            : 
      16                 :          0 : static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
      17                 :            : {
      18                 :        192 :         (*pos)++;
      19         [ +  - ]:        192 :         if (*pos > nr_irqs)
      20                 :            :                 return NULL;
      21                 :        192 :         return pos;
      22                 :            : }
      23                 :            : 
      24                 :          0 : static void int_seq_stop(struct seq_file *f, void *v)
      25                 :            : {
      26                 :            :         /* Nothing to do */
      27                 :          3 : }
      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                 :          0 : static int interrupts_open(struct inode *inode, struct file *filp)
      37                 :            : {
      38                 :          1 :         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                 :          0 : static int __init proc_interrupts_init(void)
      49                 :            : {
      50                 :            :         proc_create("interrupts", 0, NULL, &proc_interrupts_operations);
      51                 :          0 :         return 0;
      52                 :            : }
      53                 :            : module_init(proc_interrupts_init);

Generated by: LCOV version 1.9