Commit 3a42f4c7 authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim

perf pmu: Const-ify file APIs

File APIs don't alter the struct pmu so allow const ones to be passed.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: James Clark <james.clark@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Will Deacon <will@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: John Garry <john.g.garry@oracle.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Link: https://lore.kernel.org/r/20231012175645.1849503-5-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 672bd213
...@@ -575,7 +575,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, ...@@ -575,7 +575,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
return 0; return 0;
} }
static inline bool pmu_alias_info_file(char *name) static inline bool pmu_alias_info_file(const char *name)
{ {
size_t len; size_t len;
...@@ -1770,7 +1770,7 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu) ...@@ -1770,7 +1770,7 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu)
return !strcmp(pmu->name, "kprobe") || !strcmp(pmu->name, "uprobe"); 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]; char path[PATH_MAX];
...@@ -1781,7 +1781,7 @@ FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name) ...@@ -1781,7 +1781,7 @@ FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name)
return fopen(path, "r"); 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; int fd;
...@@ -1792,7 +1792,7 @@ FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name) ...@@ -1792,7 +1792,7 @@ FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name)
return fdopen(fd, "r"); 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; va_list args;
...@@ -1809,7 +1809,7 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...@@ -1809,7 +1809,7 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
return ret; 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, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -1826,7 +1826,7 @@ int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, ...@@ -1826,7 +1826,7 @@ int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name,
return ret; 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]; char path[PATH_MAX];
......
...@@ -222,14 +222,15 @@ bool pmu__name_match(const struct perf_pmu *pmu, const char *pmu_name); ...@@ -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); 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(const 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_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(const struct perf_pmu *pmu, const char *name, const char *fmt, ...)
int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, __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); 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); int perf_pmu__test(void);
......
...@@ -98,7 +98,7 @@ struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused) ...@@ -98,7 +98,7 @@ struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused)
return NULL; 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; return EOF;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment