perf buildid: Rename and export build_id_cache__cachedir()
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 8 Jun 2016 09:29:30 +0000 (18:29 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 14 Jun 2016 12:29:54 +0000 (09:29 -0300)
Rename and export build_id_cache__cachedir() for retrieving use of the
path of cache directory for given build_id.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160608092930.3116.67575.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/build-id.c
tools/perf/util/build-id.h

index 20aef90bf19412fc32a6734b7dec8849922155a1..62b147366d017107675f4881cc06fa410aa572d0 100644 (file)
@@ -387,9 +387,8 @@ void disable_buildid_cache(void)
        no_buildid_cache = true;
 }
 
-static char *build_id_cache__dirname_from_path(const char *name,
-                                              bool is_kallsyms, bool is_vdso,
-                                              const char *sbuild_id)
+char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
+                              bool is_kallsyms, bool is_vdso)
 {
        char *realname = (char *)name, *filename;
        bool slash = is_kallsyms || is_vdso;
@@ -417,8 +416,7 @@ int build_id_cache__list_build_ids(const char *pathname,
        char *dir_name;
        int ret = 0;
 
-       dir_name = build_id_cache__dirname_from_path(pathname, false, false,
-                                                    NULL);
+       dir_name = build_id_cache__cachedir(NULL, pathname, false, false);
        if (!dir_name)
                return -ENOMEM;
 
@@ -444,8 +442,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *name,
                        goto out_free;
        }
 
-       dir_name = build_id_cache__dirname_from_path(name, is_kallsyms,
-                                                    is_vdso, sbuild_id);
+       dir_name = build_id_cache__cachedir(sbuild_id, name,
+                                           is_kallsyms, is_vdso);
        if (!dir_name)
                goto out_free;
 
index e5435f46e48e5e2ee9955a05500c6345fa1775f2..d8c7f2fc6a878bddec7fd8bc7c971b0190ffd8d6 100644 (file)
@@ -30,6 +30,8 @@ bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
 int perf_session__write_buildid_table(struct perf_session *session, int fd);
 int perf_session__cache_build_ids(struct perf_session *session);
 
+char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
+                              bool is_kallsyms, bool is_vdso);
 int build_id_cache__list_build_ids(const char *pathname,
                                   struct strlist **result);
 bool build_id_cache__cached(const char *sbuild_id);