April 10, 2025 at 24:11, "Steven Rostedt" <[email protected]> wrote:
> > On Wed, 9 Apr 2025 18:29:33 +0800 > > Jiayuan Chen <[email protected]> wrote: > > > > > +#define trace_sockmap_skmsg_redirect(sk, prog, msg, act) \ > > + trace_sockmap_redirect((sk), "msg", (prog), (msg)->sg.size, (act)) > > + > > +#define trace_sockmap_skb_redirect(sk, prog, skb, act) \ > > + trace_sockmap_redirect((sk), "skb", (prog), (skb)->len, (act)) > > + > > +TRACE_EVENT(sockmap_redirect, > > + TP_PROTO(const struct sock *sk, const char *type, > > + const struct bpf_prog *prog, int length, int act), > > + TP_ARGS(sk, type, prog, length, act), > > + > > + TP_STRUCT__entry( > > + __field(const void *, sk) > > + __field(const char *, type) > > > > On 64bit, const char * is 8 bytes, and you are pointing it to a string of > size 4 bytes (3 chars and '\0'). Why not just make it a constant string, or > better yet, an enum? > > -- Steve > Using an enum is indeed more appropriate in TRACE. Thank you for the suggestion.
