9p.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM 9p
  3. #if !defined(_TRACE_9P_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_9P_H
  5. #include <linux/tracepoint.h>
  6. #define P9_MSG_T \
  7. EM( P9_TLERROR, "P9_TLERROR" ) \
  8. EM( P9_RLERROR, "P9_RLERROR" ) \
  9. EM( P9_TSTATFS, "P9_TSTATFS" ) \
  10. EM( P9_RSTATFS, "P9_RSTATFS" ) \
  11. EM( P9_TLOPEN, "P9_TLOPEN" ) \
  12. EM( P9_RLOPEN, "P9_RLOPEN" ) \
  13. EM( P9_TLCREATE, "P9_TLCREATE" ) \
  14. EM( P9_RLCREATE, "P9_RLCREATE" ) \
  15. EM( P9_TSYMLINK, "P9_TSYMLINK" ) \
  16. EM( P9_RSYMLINK, "P9_RSYMLINK" ) \
  17. EM( P9_TMKNOD, "P9_TMKNOD" ) \
  18. EM( P9_RMKNOD, "P9_RMKNOD" ) \
  19. EM( P9_TRENAME, "P9_TRENAME" ) \
  20. EM( P9_RRENAME, "P9_RRENAME" ) \
  21. EM( P9_TREADLINK, "P9_TREADLINK" ) \
  22. EM( P9_RREADLINK, "P9_RREADLINK" ) \
  23. EM( P9_TGETATTR, "P9_TGETATTR" ) \
  24. EM( P9_RGETATTR, "P9_RGETATTR" ) \
  25. EM( P9_TSETATTR, "P9_TSETATTR" ) \
  26. EM( P9_RSETATTR, "P9_RSETATTR" ) \
  27. EM( P9_TXATTRWALK, "P9_TXATTRWALK" ) \
  28. EM( P9_RXATTRWALK, "P9_RXATTRWALK" ) \
  29. EM( P9_TXATTRCREATE, "P9_TXATTRCREATE" ) \
  30. EM( P9_RXATTRCREATE, "P9_RXATTRCREATE" ) \
  31. EM( P9_TREADDIR, "P9_TREADDIR" ) \
  32. EM( P9_RREADDIR, "P9_RREADDIR" ) \
  33. EM( P9_TFSYNC, "P9_TFSYNC" ) \
  34. EM( P9_RFSYNC, "P9_RFSYNC" ) \
  35. EM( P9_TLOCK, "P9_TLOCK" ) \
  36. EM( P9_RLOCK, "P9_RLOCK" ) \
  37. EM( P9_TGETLOCK, "P9_TGETLOCK" ) \
  38. EM( P9_RGETLOCK, "P9_RGETLOCK" ) \
  39. EM( P9_TLINK, "P9_TLINK" ) \
  40. EM( P9_RLINK, "P9_RLINK" ) \
  41. EM( P9_TMKDIR, "P9_TMKDIR" ) \
  42. EM( P9_RMKDIR, "P9_RMKDIR" ) \
  43. EM( P9_TRENAMEAT, "P9_TRENAMEAT" ) \
  44. EM( P9_RRENAMEAT, "P9_RRENAMEAT" ) \
  45. EM( P9_TUNLINKAT, "P9_TUNLINKAT" ) \
  46. EM( P9_RUNLINKAT, "P9_RUNLINKAT" ) \
  47. EM( P9_TVERSION, "P9_TVERSION" ) \
  48. EM( P9_RVERSION, "P9_RVERSION" ) \
  49. EM( P9_TAUTH, "P9_TAUTH" ) \
  50. EM( P9_RAUTH, "P9_RAUTH" ) \
  51. EM( P9_TATTACH, "P9_TATTACH" ) \
  52. EM( P9_RATTACH, "P9_RATTACH" ) \
  53. EM( P9_TERROR, "P9_TERROR" ) \
  54. EM( P9_RERROR, "P9_RERROR" ) \
  55. EM( P9_TFLUSH, "P9_TFLUSH" ) \
  56. EM( P9_RFLUSH, "P9_RFLUSH" ) \
  57. EM( P9_TWALK, "P9_TWALK" ) \
  58. EM( P9_RWALK, "P9_RWALK" ) \
  59. EM( P9_TOPEN, "P9_TOPEN" ) \
  60. EM( P9_ROPEN, "P9_ROPEN" ) \
  61. EM( P9_TCREATE, "P9_TCREATE" ) \
  62. EM( P9_RCREATE, "P9_RCREATE" ) \
  63. EM( P9_TREAD, "P9_TREAD" ) \
  64. EM( P9_RREAD, "P9_RREAD" ) \
  65. EM( P9_TWRITE, "P9_TWRITE" ) \
  66. EM( P9_RWRITE, "P9_RWRITE" ) \
  67. EM( P9_TCLUNK, "P9_TCLUNK" ) \
  68. EM( P9_RCLUNK, "P9_RCLUNK" ) \
  69. EM( P9_TREMOVE, "P9_TREMOVE" ) \
  70. EM( P9_RREMOVE, "P9_RREMOVE" ) \
  71. EM( P9_TSTAT, "P9_TSTAT" ) \
  72. EM( P9_RSTAT, "P9_RSTAT" ) \
  73. EM( P9_TWSTAT, "P9_TWSTAT" ) \
  74. EMe(P9_RWSTAT, "P9_RWSTAT" )
  75. /* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */
  76. #undef EM
  77. #undef EMe
  78. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  79. #define EMe(a, b) TRACE_DEFINE_ENUM(a);
  80. P9_MSG_T
  81. /*
  82. * Now redefine the EM() and EMe() macros to map the enums to the strings
  83. * that will be printed in the output.
  84. */
  85. #undef EM
  86. #undef EMe
  87. #define EM(a, b) { a, b },
  88. #define EMe(a, b) { a, b }
  89. #define show_9p_op(type) \
  90. __print_symbolic(type, P9_MSG_T)
  91. TRACE_EVENT(9p_client_req,
  92. TP_PROTO(struct p9_client *clnt, int8_t type, int tag),
  93. TP_ARGS(clnt, type, tag),
  94. TP_STRUCT__entry(
  95. __field( void *, clnt )
  96. __field( __u8, type )
  97. __field( __u32, tag )
  98. ),
  99. TP_fast_assign(
  100. __entry->clnt = clnt;
  101. __entry->type = type;
  102. __entry->tag = tag;
  103. ),
  104. TP_printk("client %lu request %s tag %d",
  105. (long)__entry->clnt, show_9p_op(__entry->type),
  106. __entry->tag)
  107. );
  108. TRACE_EVENT(9p_client_res,
  109. TP_PROTO(struct p9_client *clnt, int8_t type, int tag, int err),
  110. TP_ARGS(clnt, type, tag, err),
  111. TP_STRUCT__entry(
  112. __field( void *, clnt )
  113. __field( __u8, type )
  114. __field( __u32, tag )
  115. __field( __u32, err )
  116. ),
  117. TP_fast_assign(
  118. __entry->clnt = clnt;
  119. __entry->type = type;
  120. __entry->tag = tag;
  121. __entry->err = err;
  122. ),
  123. TP_printk("client %lu response %s tag %d err %d",
  124. (long)__entry->clnt, show_9p_op(__entry->type),
  125. __entry->tag, __entry->err)
  126. );
  127. /* dump 32 bytes of protocol data */
  128. #define P9_PROTO_DUMP_SZ 32
  129. TRACE_EVENT(9p_protocol_dump,
  130. TP_PROTO(struct p9_client *clnt, struct p9_fcall *pdu),
  131. TP_ARGS(clnt, pdu),
  132. TP_STRUCT__entry(
  133. __field( void *, clnt )
  134. __field( __u8, type )
  135. __field( __u16, tag )
  136. __array( unsigned char, line, P9_PROTO_DUMP_SZ )
  137. ),
  138. TP_fast_assign(
  139. __entry->clnt = clnt;
  140. __entry->type = pdu->id;
  141. __entry->tag = pdu->tag;
  142. memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ);
  143. ),
  144. TP_printk("clnt %lu %s(tag = %d)\n%.3x: %16ph\n%.3x: %16ph\n",
  145. (unsigned long)__entry->clnt, show_9p_op(__entry->type),
  146. __entry->tag, 0, __entry->line, 16, __entry->line + 16)
  147. );
  148. #endif /* _TRACE_9P_H */
  149. /* This part must be outside protection */
  150. #include <trace/define_trace.h>