[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230816110206.13980573@gandalf.local.home>
Date: Wed, 16 Aug 2023 11:02:06 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Manjusaka <me@...jusaka.me>
Cc: Joe Perches <joe@...ches.com>, edumazet@...gle.com,
bpf@...r.kernel.org, davem@...emloft.net, dsahern@...nel.org,
kuba@...nel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, mhiramat@...nel.org,
ncardwell@...gle.com, netdev@...r.kernel.org, pabeni@...hat.com
Subject: Re: [PATCH v3] tracepoint: add new `tcp:tcp_ca_event` trace event
On Wed, 16 Aug 2023 14:09:06 +0800
Manjusaka <me@...jusaka.me> wrote:
> > +# trace include files use a completely different grammar
> > + next if ($realfile =~ m{(?:include/trace/events/|/trace\.h$/)});
> > +
> > # check multi-line statement indentation matches previous line
> > if ($perl_version_ok &&
> > $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
> >
> >
> >
>
> Actually, I'm not sure this is the checkpatch style issue or my code style issue.
>
> Seems wired.
The TRACE_EVENT() macro has its own style. I need to document it, and
perhaps one day get checkpatch to understand it as well.
The TRACE_EVENT() typically looks like:
TRACE_EVENT(name,
TP_PROTO(int arg1, struct foo *arg2, struct bar *arg3),
TP_ARGS(arg1, arg2, arg3),
TP_STRUCT__entry(
__field( int, field1 )
__array( char, mystring, MYSTRLEN )
__string( filename, arg3->name )
),
TP_fast_assign(
__entry->field1 = arg1;
memcpy(__entry->mystring, arg2->string);
__assign_str(filename, arg3->name);
),
TP_printk("field1=%d mystring=%s filename=%s",
__entry->field1, __entry->mystring, __get_str(filename))
);
The TP_STRUCT__entry() should be considered more of a "struct" layout than
a macro layout, and that's where checkpatch gets confused. The spacing
makes it much easier to see the fields and their types.
-- Steve
Powered by blists - more mailing lists