lkml.org 
[lkml]   [2020]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 21/25] perf tools: Add build_id_cache__add function
Em Thu, Nov 26, 2020 at 06:00:22PM +0100, Jiri Olsa escreveu:
> Adding build_id_cache__add function as core function
> that adds file into build id database. It will be
> set from another callers in following changes.

Thanks, applied.

- Arnaldo


> Acked-by: Ian Rogers <irogers@google.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/util/build-id.c | 42 ++++++++++++++++++++++++--------------
> tools/perf/util/build-id.h | 2 ++
> 2 files changed, 29 insertions(+), 15 deletions(-)
>
> diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
> index 6bf3cc79c5d5..02df36b30ac5 100644
> --- a/tools/perf/util/build-id.c
> +++ b/tools/perf/util/build-id.c
> @@ -671,24 +671,15 @@ static char *build_id_cache__find_debug(const char *sbuild_id,
> return realname;
> }
>
> -int build_id_cache__add_s(const char *sbuild_id, const char *name,
> - struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
> +int
> +build_id_cache__add(const char *sbuild_id, const char *name, const char *realname,
> + struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
> {
> const size_t size = PATH_MAX;
> - char *realname = NULL, *filename = NULL, *dir_name = NULL,
> - *linkname = zalloc(size), *tmp;
> + char *filename = NULL, *dir_name = NULL, *linkname = zalloc(size), *tmp;
> char *debugfile = NULL;
> int err = -1;
>
> - if (!is_kallsyms) {
> - if (!is_vdso)
> - realname = nsinfo__realpath(name, nsi);
> - else
> - realname = realpath(name, NULL);
> - if (!realname)
> - goto out_free;
> - }
> -
> dir_name = build_id_cache__cachedir(sbuild_id, name, nsi, is_kallsyms,
> is_vdso);
> if (!dir_name)
> @@ -788,8 +779,6 @@ int build_id_cache__add_s(const char *sbuild_id, const char *name,
> pr_debug4("Failed to update/scan SDT cache for %s\n", realname);
>
> out_free:
> - if (!is_kallsyms)
> - free(realname);
> free(filename);
> free(debugfile);
> free(dir_name);
> @@ -797,6 +786,29 @@ int build_id_cache__add_s(const char *sbuild_id, const char *name,
> return err;
> }
>
> +int build_id_cache__add_s(const char *sbuild_id, const char *name,
> + struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
> +{
> + char *realname = NULL;
> + int err = -1;
> +
> + if (!is_kallsyms) {
> + if (!is_vdso)
> + realname = nsinfo__realpath(name, nsi);
> + else
> + realname = realpath(name, NULL);
> + if (!realname)
> + goto out_free;
> + }
> +
> + err = build_id_cache__add(sbuild_id, name, realname, nsi, is_kallsyms, is_vdso);
> +
> +out_free:
> + if (!is_kallsyms)
> + free(realname);
> + return err;
> +}
> +
> static int build_id_cache__add_b(const struct build_id *bid,
> const char *name, struct nsinfo *nsi,
> bool is_kallsyms, bool is_vdso)
> diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
> index c6f10e3d2152..02613f4b2c29 100644
> --- a/tools/perf/util/build-id.h
> +++ b/tools/perf/util/build-id.h
> @@ -63,6 +63,8 @@ char *build_id_cache__complement(const char *incomplete_sbuild_id);
> int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
> struct strlist **result);
> bool build_id_cache__cached(const char *sbuild_id);
> +int build_id_cache__add(const char *sbuild_id, const char *name, const char *realname,
> + struct nsinfo *nsi, bool is_kallsyms, bool is_vdso);
> int build_id_cache__add_s(const char *sbuild_id,
> const char *name, struct nsinfo *nsi,
> bool is_kallsyms, bool is_vdso);
> --
> 2.26.2
>

--

- Arnaldo

\
 
 \ /
  Last update: 2020-11-26 18:55    [W:0.225 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site