9p.h 5.1 KB

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