[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82771f1c-9659-4aaa-bded-62bef6082bf8@manjusaka.me>
Date: Thu, 17 Aug 2023 00:58:05 +0800
From: Manjusaka <me@...jusaka.me>
To: Steven Rostedt <rostedt@...dmis.org>
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 2023/8/16 23:02, Steven Rostedt wrote:
> 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
Thanks for the explain!
So could I keep the current code without any code style change?
I think it would be a good idea to fix the checkpatch.pl script in another patch
Powered by blists - more mailing lists