From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: James Clark <james.clark@arm.com>
Cc: "Alexey Dobriyan" <adobriyan@gmail.com>,
"Chaitanya S Prakash" <ChaitanyaS.Prakash@arm.com>,
"Ian Rogers" <irogers@google.com>,
linux-perf-users@vger.kernel.org, anshuman.khandual@arm.com,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"Mike Leach" <mike.leach@linaro.org>,
"John Garry" <john.g.garry@oracle.com>,
"Will Deacon" <will@kernel.org>, "Leo Yan" <leo.yan@linaro.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Namhyung Kim" <namhyung@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Chenyuan Mi" <cymi20@fudan.edu.cn>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Ravi Bangoria" <ravi.bangoria@amd.com>,
"Ahelenia Ziemiańska" <nabijaczleweli@nabijaczleweli.xyz>,
"Colin Ian King" <colin.i.king@gmail.com>,
"Changbin Du" <changbin.du@huawei.com>,
"Kan Liang" <kan.liang@linux.intel.com>,
"Athira Rajeev" <atrajeev@linux.vnet.ibm.com>,
"Tiezhu Yang" <yangtiezhu@loongson.cn>,
"Georg Müller" <georgmueller@gmx.net>,
"Liam Howlett" <liam.howlett@oracle.com>,
bpf@vger.kernel.org, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU"
Date: Wed, 17 Apr 2024 10:39:56 -0300 [thread overview]
Message-ID: <Zh_RLG7a1xauRNK1@x1> (raw)
In-Reply-To: <1b52699d-8f92-4a79-89aa-c4df1594e8b1@arm.com>
On Wed, Apr 17, 2024 at 02:24:33PM +0100, James Clark wrote:
> On 14/04/2024 12:41, Alexey Dobriyan wrote:
> > On Thu, Apr 11, 2024 at 05:40:04PM +0530, Chaitanya S Prakash wrote:
> >> On 4/9/24 11:02, Alexey Dobriyan wrote:
> >>> On Mon, Apr 08, 2024 at 11:52:22AM +0530, Chaitanya S Prakash wrote:
> >>>> - Add str_has_suffix() and str_has_prefix() to tools/lib/string.c
> >>>> - Delete ends_with() and replace its usage with str_has_suffix()
> >>>> - Delete strstarts() from tools/include/linux/string.h and replace its
> >>>> usage with str_has_prefix()
> >>> It should be the other way: starts_with is normal in userspace.
> >>> C++, Python, Java, C# all have it. JavaScript too!
> >>
> >> This is done in accordance with Ian's comments on V1 of this patch
> >> series. Please find the link to the same below.
> >
> > Yes, but str_has_suffix() doesn't make sense in the wider context.
> >
> >> https://lore.kernel.org/all/CAP-5=fUFmeoTjLuZTgcaV23iGQU1AdddG+7Rw=d6buMU007+1Q@mail.gmail.com/
> >
> > The naming ends_with makes sense but there is also strstarts and
> > str_has_prefix, perhaps str_has_suffix would be the most consistent
> > and intention revealing name?
> From a brief check it looks like str_has_prefix() is already quite
> common with 94 uses. So the path of least resistance is to make
> everything self consistent and add str_has_suffix().
> I agree it's a bit of a mouthful and not so common in other languages.
> Once this more complicated set gets through we could always do a simple
> search and replace change it to anything we like. But it would touch
> _lots_ of different drivers and trees, so it would be hard to justify.
Right, we try to follow the kernel APIs to make tools/perf more familiar
to kernel developers, this return strlen() thing on str_has_prefix()
looked too clever for me at first, but since we need to do it anyway,
and return !0 to indicate it has the prefix and there are usecase...
The bpftool people agreed as well, so in tools/ it seems we're in
general agreement about using str_has_{prefix,suffix}().
- Arnaldo
next prev parent reply other threads:[~2024-04-17 13:40 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 6:22 [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Chaitanya S Prakash
2024-04-08 6:22 ` [PATCH V2 1/8] tools lib: adopt str_has_suffix() from bpftool/gen.c Chaitanya S Prakash
2024-04-08 23:32 ` Masami Hiramatsu
2024-04-11 12:15 ` Chaitanya S Prakash
2024-04-11 15:41 ` Arnaldo Carvalho de Melo
2024-04-08 6:22 ` [PATCH V2 2/8] perf util: Delete ends_with() and replace its use with str_has_suffix() Chaitanya S Prakash
2024-04-08 6:22 ` [PATCH V2 3/8] perf util: Replace an instance of strtailcmp() by str_has_suffix() Chaitanya S Prakash
2024-04-08 23:20 ` Masami Hiramatsu
2024-04-08 6:22 ` [PATCH V2 4/8] tools lib: Adopt str_has_prefix() from kernel Chaitanya S Prakash
2024-04-08 23:33 ` Masami Hiramatsu
2024-04-08 6:22 ` [PATCH V2 5/8] tools: Delete strstarts() and replace its usage with str_has_prefix() Chaitanya S Prakash
2024-04-18 7:32 ` kernel test robot
2024-04-08 6:22 ` [PATCH V2 6/8] perf tools: Enable configs required for test_uprobe_from_different_cu.sh Chaitanya S Prakash
2024-04-08 23:11 ` Masami Hiramatsu
2024-04-16 21:19 ` Arnaldo Carvalho de Melo
2024-04-08 6:22 ` [PATCH V2 7/8] perf tools: Only treat files as map files when they have the extension .map Chaitanya S Prakash
2024-04-09 10:21 ` James Clark
2024-04-08 6:22 ` [PATCH V2 8/8] perf test: Check output of the probe ... --funcs command Chaitanya S Prakash
2024-04-08 23:09 ` Masami Hiramatsu
2024-04-16 21:22 ` Arnaldo Carvalho de Melo
2024-04-17 18:26 ` Arnaldo Carvalho de Melo
2024-04-23 11:53 ` Chaitanya S Prakash
2024-04-09 5:32 ` [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Alexey Dobriyan
2024-04-11 12:10 ` Chaitanya S Prakash
2024-04-14 11:41 ` Alexey Dobriyan
2024-04-17 13:24 ` James Clark
2024-04-17 13:39 ` Arnaldo Carvalho de Melo [this message]
2024-04-10 3:34 ` Chaitanya S Prakash
2024-04-11 18:49 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zh_RLG7a1xauRNK1@x1 \
--to=acme@kernel.org \
--cc=ChaitanyaS.Prakash@arm.com \
--cc=adobriyan@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=changbin.du@huawei.com \
--cc=colin.i.king@gmail.com \
--cc=coresight@lists.linaro.org \
--cc=cymi20@fudan.edu.cn \
--cc=georgmueller@gmx.net \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linaro.org \
--cc=liam.howlett@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=nabijaczleweli@nabijaczleweli.xyz \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).