summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/io/traceio2.stp
blob: 988ea36cf22c17af14a27bd3e2ec2efe00a9f4bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
global device_of_interest

probe begin {
  /* The following is not the most efficient way to do this.
      One could directly put the result of usrdev2kerndev()
      into device_of_interest.  However, want to test out
      the other device functions */
  dev = usrdev2kerndev($1)
  device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
}

probe kernel.function ("vfs_write"),
      kernel.function ("vfs_read")
{
        dev_nr = $file->
             	%( kernel_v < "2.6.19" %? f_dentry %: f_path->dentry %)
		->d_inode->i_sb->s_dev

        if (dev_nr == device_of_interest)
                printf ("%s(%d) %s 0x%x\n",
		        execname(), pid(), probefunc(), dev_nr)
}