From: Adrian Hunter <adrian.hunter@intel.com>
To: Ian Rogers <irogers@google.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@arm.com>, Leo Yan <leo.yan@linaro.org>,
John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Thomas Richter <tmricht@linux.ibm.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
Kajol Jain <kjain@linux.ibm.com>,
Jing Zhang <renyu.zj@linux.alibaba.com>,
Kan Liang <kan.liang@linux.intel.com>,
Yang Jihong <yangjihong1@huawei.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/7] perf pmu: Const-ify file APIs
Date: Thu, 12 Oct 2023 14:52:51 +0300 [thread overview]
Message-ID: <5779887c-d712-40d2-963b-8c912b8cf5fc@intel.com> (raw)
In-Reply-To: <20231007021326.4156714-5-irogers@google.com>
On 7/10/23 05:13, Ian Rogers wrote:
> File APIs don't alter the struct pmu so allow const ones to be passed.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/util/pmu.c | 12 ++++++------
> tools/perf/util/pmu.h | 11 ++++++-----
> tools/perf/util/python.c | 2 +-
> 3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 6e95b3d2c2e3..e11901c923d7 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -575,7 +575,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
> return 0;
> }
>
> -static inline bool pmu_alias_info_file(char *name)
> +static inline bool pmu_alias_info_file(const char *name)
> {
> size_t len;
>
> @@ -1771,7 +1771,7 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu)
> return !strcmp(pmu->name, "kprobe") || !strcmp(pmu->name, "uprobe");
> }
>
> -FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name)
> +FILE *perf_pmu__open_file(const struct perf_pmu *pmu, const char *name)
> {
> char path[PATH_MAX];
>
> @@ -1782,7 +1782,7 @@ FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name)
> return fopen(path, "r");
> }
>
> -FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name)
> +FILE *perf_pmu__open_file_at(const struct perf_pmu *pmu, int dirfd, const char *name)
> {
> int fd;
>
> @@ -1793,7 +1793,7 @@ FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name)
> return fdopen(fd, "r");
> }
>
> -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
> +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt,
> ...)
> {
> va_list args;
> @@ -1810,7 +1810,7 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
> return ret;
> }
>
> -int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name,
> +int perf_pmu__scan_file_at(const struct perf_pmu *pmu, int dirfd, const char *name,
> const char *fmt, ...)
> {
> va_list args;
> @@ -1827,7 +1827,7 @@ int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name,
> return ret;
> }
>
> -bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name)
> +bool perf_pmu__file_exists(const struct perf_pmu *pmu, const char *name)
> {
> char path[PATH_MAX];
>
> diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> index 588c64e38d6b..24af7297b522 100644
> --- a/tools/perf/util/pmu.h
> +++ b/tools/perf/util/pmu.h
> @@ -222,14 +222,15 @@ bool pmu__name_match(const struct perf_pmu *pmu, const char *pmu_name);
> */
> bool perf_pmu__is_software(const struct perf_pmu *pmu);
>
> -FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name);
> -FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name);
> +FILE *perf_pmu__open_file(const struct perf_pmu *pmu, const char *name);
> +FILE *perf_pmu__open_file_at(const struct perf_pmu *pmu, int dirfd, const char *name);
>
> -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...) __scanf(3, 4);
> -int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name,
> +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...)
> + __scanf(3, 4);
> +int perf_pmu__scan_file_at(const struct perf_pmu *pmu, int dirfd, const char *name,
> const char *fmt, ...) __scanf(4, 5);
>
> -bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name);
> +bool perf_pmu__file_exists(const struct perf_pmu *pmu, const char *name);
>
> int perf_pmu__test(void);
>
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index c29f5f0bb552..8761f51b5c7c 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -98,7 +98,7 @@ struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused)
> return NULL;
> }
>
> -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...)
> +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...)
> {
> return EOF;
> }
next prev parent reply other threads:[~2023-10-12 11:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-07 2:13 [PATCH v1 0/7] PMU performance improvements Ian Rogers
2023-10-07 2:13 ` [PATCH v1 1/7] perf pmu: Rename perf_pmu__get_default_config to perf_pmu__arch_init Ian Rogers
2023-10-12 11:51 ` Adrian Hunter
2023-10-12 15:23 ` Ian Rogers
2023-10-07 2:13 ` [PATCH v1 2/7] perf intel-pt: Move PMU initialization from default config code Ian Rogers
2023-10-12 11:52 ` Adrian Hunter
2023-10-07 2:13 ` [PATCH v1 3/7] perf arm-spe: " Ian Rogers
2023-10-12 11:52 ` Adrian Hunter
2023-10-07 2:13 ` [PATCH v1 4/7] perf pmu: Const-ify file APIs Ian Rogers
2023-10-12 11:52 ` Adrian Hunter [this message]
2023-10-07 2:13 ` [PATCH v1 5/7] perf pmu: Const-ify perf_pmu__config_terms Ian Rogers
2023-10-12 11:53 ` Adrian Hunter
2023-10-07 2:13 ` [PATCH v1 6/7] perf pmu-events: Remember the events and metrics table Ian Rogers
2023-10-08 3:39 ` Yang Jihong
2023-10-08 5:49 ` Ian Rogers
2023-10-08 9:36 ` Yang Jihong
2023-10-12 11:53 ` Adrian Hunter
2023-10-07 2:13 ` [PATCH v1 7/7] perf pmu: Lazily compute default config Ian Rogers
2023-10-12 11:53 ` Adrian Hunter
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=5779887c-d712-40d2-963b-8c912b8cf5fc@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=leo.yan@linaro.org \
--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=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=renyu.zj@linux.alibaba.com \
--cc=suzuki.poulose@arm.com \
--cc=tmricht@linux.ibm.com \
--cc=will@kernel.org \
--cc=yangjihong1@huawei.com \
/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
all inboxes | Powered by JetHome®