android_fs_template.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !defined(_TRACE_ANDROID_FS_TEMPLATE_H) || defined(TRACE_HEADER_MULTI_READ)
  2. #define _TRACE_ANDROID_FS_TEMPLATE_H
  3. #include <linux/tracepoint.h>
  4. DECLARE_EVENT_CLASS(android_fs_data_start_template,
  5. TP_PROTO(struct inode *inode, loff_t offset, int bytes,
  6. pid_t pid, char *pathname, char *command),
  7. TP_ARGS(inode, offset, bytes, pid, pathname, command),
  8. TP_STRUCT__entry(
  9. __string(pathbuf, pathname);
  10. __field(loff_t, offset);
  11. __field(int, bytes);
  12. __field(loff_t, i_size);
  13. __string(cmdline, command);
  14. __field(pid_t, pid);
  15. __field(ino_t, ino);
  16. ),
  17. TP_fast_assign(
  18. {
  19. /*
  20. * Replace the spaces in filenames and cmdlines
  21. * because this screws up the tooling that parses
  22. * the traces.
  23. */
  24. __assign_str(pathbuf, pathname);
  25. (void)strreplace(__get_str(pathbuf), ' ', '_');
  26. __entry->offset = offset;
  27. __entry->bytes = bytes;
  28. __entry->i_size = i_size_read(inode);
  29. __assign_str(cmdline, command);
  30. (void)strreplace(__get_str(cmdline), ' ', '_');
  31. __entry->pid = pid;
  32. __entry->ino = inode->i_ino;
  33. }
  34. ),
  35. TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
  36. " pid %d, i_size %llu, ino %lu",
  37. __get_str(pathbuf), __entry->offset, __entry->bytes,
  38. __get_str(cmdline), __entry->pid, __entry->i_size,
  39. (unsigned long) __entry->ino)
  40. );
  41. DECLARE_EVENT_CLASS(android_fs_data_end_template,
  42. TP_PROTO(struct inode *inode, loff_t offset, int bytes),
  43. TP_ARGS(inode, offset, bytes),
  44. TP_STRUCT__entry(
  45. __field(ino_t, ino);
  46. __field(loff_t, offset);
  47. __field(int, bytes);
  48. ),
  49. TP_fast_assign(
  50. {
  51. __entry->ino = inode->i_ino;
  52. __entry->offset = offset;
  53. __entry->bytes = bytes;
  54. }
  55. ),
  56. TP_printk("ino %lu, offset %llu, bytes %d",
  57. (unsigned long) __entry->ino,
  58. __entry->offset, __entry->bytes)
  59. );
  60. #endif /* _TRACE_ANDROID_FS_TEMPLATE_H */