tracepoint-probe-sample2.c 875 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * tracepoint-probe-sample2.c
  3. *
  4. * 2nd sample tracepoint probes.
  5. */
  6. #include <linux/module.h>
  7. #include <linux/fs.h>
  8. #include "tp-samples-trace.h"
  9. /*
  10. * Here the caller only guarantees locking for struct file and struct inode.
  11. * Locking must therefore be done in the probe to use the dentry.
  12. */
  13. static void probe_subsys_event(struct inode *inode, struct file *file)
  14. {
  15. printk(KERN_INFO "Event is encountered with inode number %lu\n",
  16. inode->i_ino);
  17. }
  18. int __init tp_sample_trace_init(void)
  19. {
  20. int ret;
  21. ret = register_trace_subsys_event(probe_subsys_event);
  22. WARN_ON(ret);
  23. return 0;
  24. }
  25. module_init(tp_sample_trace_init);
  26. void __exit tp_sample_trace_exit(void)
  27. {
  28. unregister_trace_subsys_event(probe_subsys_event);
  29. }
  30. module_exit(tp_sample_trace_exit);
  31. MODULE_LICENSE("GPL");
  32. MODULE_AUTHOR("Mathieu Desnoyers");
  33. MODULE_DESCRIPTION("Tracepoint Probes Samples");