mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 21:44:06 +08:00
perf build-id: Add build_id_cache__add function
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. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20201126170026.2619053-22-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
75fb2af68e
commit
fd4ebb457c
@ -671,24 +671,15 @@ out:
|
|||||||
return realname;
|
return realname;
|
||||||
}
|
}
|
||||||
|
|
||||||
int build_id_cache__add_s(const char *sbuild_id, const char *name,
|
int
|
||||||
struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
|
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;
|
const size_t size = PATH_MAX;
|
||||||
char *realname = NULL, *filename = NULL, *dir_name = NULL,
|
char *filename = NULL, *dir_name = NULL, *linkname = zalloc(size), *tmp;
|
||||||
*linkname = zalloc(size), *tmp;
|
|
||||||
char *debugfile = NULL;
|
char *debugfile = NULL;
|
||||||
int err = -1;
|
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,
|
dir_name = build_id_cache__cachedir(sbuild_id, name, nsi, is_kallsyms,
|
||||||
is_vdso);
|
is_vdso);
|
||||||
if (!dir_name)
|
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);
|
pr_debug4("Failed to update/scan SDT cache for %s\n", realname);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
if (!is_kallsyms)
|
|
||||||
free(realname);
|
|
||||||
free(filename);
|
free(filename);
|
||||||
free(debugfile);
|
free(debugfile);
|
||||||
free(dir_name);
|
free(dir_name);
|
||||||
@ -797,6 +786,29 @@ out_free:
|
|||||||
return err;
|
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,
|
static int build_id_cache__add_b(const struct build_id *bid,
|
||||||
const char *name, struct nsinfo *nsi,
|
const char *name, struct nsinfo *nsi,
|
||||||
bool is_kallsyms, bool is_vdso)
|
bool is_kallsyms, bool is_vdso)
|
||||||
|
@ -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,
|
int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
|
||||||
struct strlist **result);
|
struct strlist **result);
|
||||||
bool build_id_cache__cached(const char *sbuild_id);
|
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,
|
int build_id_cache__add_s(const char *sbuild_id,
|
||||||
const char *name, struct nsinfo *nsi,
|
const char *name, struct nsinfo *nsi,
|
||||||
bool is_kallsyms, bool is_vdso);
|
bool is_kallsyms, bool is_vdso);
|
||||||
|
Loading…
Reference in New Issue
Block a user