Path: blob/master/samples/tracepoints/tracepoint-probe-sample2.c
10818 views
/*1* tracepoint-probe-sample2.c2*3* 2nd sample tracepoint probes.4*/56#include <linux/module.h>7#include <linux/fs.h>8#include "tp-samples-trace.h"910/*11* Here the caller only guarantees locking for struct file and struct inode.12* Locking must therefore be done in the probe to use the dentry.13*/14static void probe_subsys_event(void *ignore,15struct inode *inode, struct file *file)16{17printk(KERN_INFO "Event is encountered with inode number %lu\n",18inode->i_ino);19}2021static int __init tp_sample_trace_init(void)22{23int ret;2425ret = register_trace_subsys_event(probe_subsys_event, NULL);26WARN_ON(ret);2728return 0;29}3031module_init(tp_sample_trace_init);3233static void __exit tp_sample_trace_exit(void)34{35unregister_trace_subsys_event(probe_subsys_event, NULL);36tracepoint_synchronize_unregister();37}3839module_exit(tp_sample_trace_exit);4041MODULE_LICENSE("GPL");42MODULE_AUTHOR("Mathieu Desnoyers");43MODULE_DESCRIPTION("Tracepoint Probes Samples");444546