Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM 9p
0004 
0005 #if !defined(_TRACE_9P_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_9P_H
0007 
0008 #include <linux/tracepoint.h>
0009 
0010 #define P9_MSG_T                            \
0011         EM( P9_TLERROR,     "P9_TLERROR" )          \
0012         EM( P9_RLERROR,     "P9_RLERROR" )          \
0013         EM( P9_TSTATFS,     "P9_TSTATFS" )          \
0014         EM( P9_RSTATFS,     "P9_RSTATFS" )          \
0015         EM( P9_TLOPEN,      "P9_TLOPEN" )           \
0016         EM( P9_RLOPEN,      "P9_RLOPEN" )           \
0017         EM( P9_TLCREATE,    "P9_TLCREATE" )         \
0018         EM( P9_RLCREATE,    "P9_RLCREATE" )         \
0019         EM( P9_TSYMLINK,    "P9_TSYMLINK" )         \
0020         EM( P9_RSYMLINK,    "P9_RSYMLINK" )         \
0021         EM( P9_TMKNOD,      "P9_TMKNOD" )           \
0022         EM( P9_RMKNOD,      "P9_RMKNOD" )           \
0023         EM( P9_TRENAME,     "P9_TRENAME" )          \
0024         EM( P9_RRENAME,     "P9_RRENAME" )          \
0025         EM( P9_TREADLINK,   "P9_TREADLINK" )        \
0026         EM( P9_RREADLINK,   "P9_RREADLINK" )        \
0027         EM( P9_TGETATTR,    "P9_TGETATTR" )         \
0028         EM( P9_RGETATTR,    "P9_RGETATTR" )         \
0029         EM( P9_TSETATTR,    "P9_TSETATTR" )         \
0030         EM( P9_RSETATTR,    "P9_RSETATTR" )         \
0031         EM( P9_TXATTRWALK,  "P9_TXATTRWALK" )       \
0032         EM( P9_RXATTRWALK,  "P9_RXATTRWALK" )       \
0033         EM( P9_TXATTRCREATE,    "P9_TXATTRCREATE" )     \
0034         EM( P9_RXATTRCREATE,    "P9_RXATTRCREATE" )     \
0035         EM( P9_TREADDIR,    "P9_TREADDIR" )         \
0036         EM( P9_RREADDIR,    "P9_RREADDIR" )         \
0037         EM( P9_TFSYNC,      "P9_TFSYNC" )           \
0038         EM( P9_RFSYNC,      "P9_RFSYNC" )           \
0039         EM( P9_TLOCK,       "P9_TLOCK" )            \
0040         EM( P9_RLOCK,       "P9_RLOCK" )            \
0041         EM( P9_TGETLOCK,    "P9_TGETLOCK" )         \
0042         EM( P9_RGETLOCK,    "P9_RGETLOCK" )         \
0043         EM( P9_TLINK,       "P9_TLINK" )            \
0044         EM( P9_RLINK,       "P9_RLINK" )            \
0045         EM( P9_TMKDIR,      "P9_TMKDIR" )           \
0046         EM( P9_RMKDIR,      "P9_RMKDIR" )           \
0047         EM( P9_TRENAMEAT,   "P9_TRENAMEAT" )        \
0048         EM( P9_RRENAMEAT,   "P9_RRENAMEAT" )        \
0049         EM( P9_TUNLINKAT,   "P9_TUNLINKAT" )        \
0050         EM( P9_RUNLINKAT,   "P9_RUNLINKAT" )        \
0051         EM( P9_TVERSION,    "P9_TVERSION" )         \
0052         EM( P9_RVERSION,    "P9_RVERSION" )         \
0053         EM( P9_TAUTH,       "P9_TAUTH" )            \
0054         EM( P9_RAUTH,       "P9_RAUTH" )            \
0055         EM( P9_TATTACH,     "P9_TATTACH" )          \
0056         EM( P9_RATTACH,     "P9_RATTACH" )          \
0057         EM( P9_TERROR,      "P9_TERROR" )           \
0058         EM( P9_RERROR,      "P9_RERROR" )           \
0059         EM( P9_TFLUSH,      "P9_TFLUSH" )           \
0060         EM( P9_RFLUSH,      "P9_RFLUSH" )           \
0061         EM( P9_TWALK,       "P9_TWALK" )            \
0062         EM( P9_RWALK,       "P9_RWALK" )            \
0063         EM( P9_TOPEN,       "P9_TOPEN" )            \
0064         EM( P9_ROPEN,       "P9_ROPEN" )            \
0065         EM( P9_TCREATE,     "P9_TCREATE" )          \
0066         EM( P9_RCREATE,     "P9_RCREATE" )          \
0067         EM( P9_TREAD,       "P9_TREAD" )            \
0068         EM( P9_RREAD,       "P9_RREAD" )            \
0069         EM( P9_TWRITE,      "P9_TWRITE" )           \
0070         EM( P9_RWRITE,      "P9_RWRITE" )           \
0071         EM( P9_TCLUNK,      "P9_TCLUNK" )           \
0072         EM( P9_RCLUNK,      "P9_RCLUNK" )           \
0073         EM( P9_TREMOVE,     "P9_TREMOVE" )          \
0074         EM( P9_RREMOVE,     "P9_RREMOVE" )          \
0075         EM( P9_TSTAT,       "P9_TSTAT" )            \
0076         EM( P9_RSTAT,       "P9_RSTAT" )            \
0077         EM( P9_TWSTAT,      "P9_TWSTAT" )           \
0078         EMe(P9_RWSTAT,      "P9_RWSTAT" )
0079 
0080 
0081 #define P9_FID_REFTYPE                          \
0082         EM( P9_FID_REF_CREATE,  "create " )         \
0083         EM( P9_FID_REF_GET, "get    " )         \
0084         EM( P9_FID_REF_PUT, "put    " )         \
0085         EMe(P9_FID_REF_DESTROY, "destroy" )
0086 
0087 /* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */
0088 #undef EM
0089 #undef EMe
0090 #define EM(a, b)    TRACE_DEFINE_ENUM(a);
0091 #define EMe(a, b)   TRACE_DEFINE_ENUM(a);
0092 
0093 P9_MSG_T
0094 P9_FID_REFTYPE
0095 
0096 /* And also use EM/EMe to define helper enums -- once */
0097 #ifndef __9P_DECLARE_TRACE_ENUMS_ONLY_ONCE
0098 #define __9P_DECLARE_TRACE_ENUMS_ONLY_ONCE
0099 #undef EM
0100 #undef EMe
0101 #define EM(a, b)    a,
0102 #define EMe(a, b)   a
0103 
0104 enum p9_fid_reftype {
0105     P9_FID_REFTYPE
0106 } __mode(byte);
0107 
0108 #endif
0109 
0110 /*
0111  * Now redefine the EM() and EMe() macros to map the enums to the strings
0112  * that will be printed in the output.
0113  */
0114 #undef EM
0115 #undef EMe
0116 #define EM(a, b)    { a, b },
0117 #define EMe(a, b)   { a, b }
0118 
0119 #define show_9p_op(type)                        \
0120     __print_symbolic(type, P9_MSG_T)
0121 #define show_9p_fid_reftype(type)                   \
0122     __print_symbolic(type, P9_FID_REFTYPE)
0123 
0124 TRACE_EVENT(9p_client_req,
0125         TP_PROTO(struct p9_client *clnt, int8_t type, int tag),
0126 
0127         TP_ARGS(clnt, type, tag),
0128 
0129         TP_STRUCT__entry(
0130             __field(    void *,     clnt                 )
0131             __field(    __u8,       type                 )
0132             __field(    __u32,      tag              )
0133             ),
0134 
0135         TP_fast_assign(
0136             __entry->clnt    =  clnt;
0137             __entry->type    =  type;
0138             __entry->tag     =  tag;
0139             ),
0140 
0141         TP_printk("client %lu request %s tag  %d",
0142             (long)__entry->clnt, show_9p_op(__entry->type),
0143             __entry->tag)
0144  );
0145 
0146 TRACE_EVENT(9p_client_res,
0147         TP_PROTO(struct p9_client *clnt, int8_t type, int tag, int err),
0148 
0149         TP_ARGS(clnt, type, tag, err),
0150 
0151         TP_STRUCT__entry(
0152             __field(    void *,     clnt                 )
0153             __field(    __u8,       type                 )
0154             __field(    __u32,      tag              )
0155             __field(    __u32,      err              )
0156             ),
0157 
0158         TP_fast_assign(
0159             __entry->clnt    =  clnt;
0160             __entry->type    =  type;
0161             __entry->tag     =  tag;
0162             __entry->err     =  err;
0163             ),
0164 
0165         TP_printk("client %lu response %s tag  %d err %d",
0166               (long)__entry->clnt, show_9p_op(__entry->type),
0167               __entry->tag, __entry->err)
0168 );
0169 
0170 /* dump 32 bytes of protocol data */
0171 #define P9_PROTO_DUMP_SZ 32
0172 TRACE_EVENT(9p_protocol_dump,
0173         TP_PROTO(struct p9_client *clnt, struct p9_fcall *pdu),
0174 
0175         TP_ARGS(clnt, pdu),
0176 
0177         TP_STRUCT__entry(
0178             __field(    void *,     clnt                )
0179             __field(    __u8,       type                )
0180             __field(    __u16,      tag             )
0181             __array(    unsigned char,  line,   P9_PROTO_DUMP_SZ    )
0182             ),
0183 
0184         TP_fast_assign(
0185             __entry->clnt   =  clnt;
0186             __entry->type   =  pdu->id;
0187             __entry->tag    =  pdu->tag;
0188             memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ);
0189             ),
0190         TP_printk("clnt %lu %s(tag = %d)\n%.3x: %16ph\n%.3x: %16ph\n",
0191               (unsigned long)__entry->clnt, show_9p_op(__entry->type),
0192               __entry->tag, 0, __entry->line, 16, __entry->line + 16)
0193  );
0194 
0195 
0196 TRACE_EVENT(9p_fid_ref,
0197         TP_PROTO(struct p9_fid *fid, __u8 type),
0198 
0199         TP_ARGS(fid, type),
0200 
0201         TP_STRUCT__entry(
0202             __field(    int,    fid     )
0203             __field(    int,    refcount    )
0204             __field(    __u8, type  )
0205             ),
0206 
0207         TP_fast_assign(
0208             __entry->fid = fid->fid;
0209             __entry->refcount = refcount_read(&fid->count);
0210             __entry->type = type;
0211             ),
0212 
0213         TP_printk("%s fid %d, refcount %d",
0214               show_9p_fid_reftype(__entry->type),
0215               __entry->fid, __entry->refcount)
0216 );
0217 
0218 
0219 #endif /* _TRACE_9P_H */
0220 
0221 /* This part must be outside protection */
0222 #include <trace/define_trace.h>