aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2014-12-01 14:06:23 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-12-09 07:14:34 -0500
commit498922adf1173ddeebd155f82646d4a9d518d606 (patch)
treebf7d80d6c7438e5de0658bb47dfb4a4dabf58ef1 /tools
parentcfd31d85bb42b96449157bd57c638dc779070753 (diff)
perf buildid-cache: Remove extra debugdir variables
There's no need to copy over the buildid_dir into separate variable with no change. This is leftover from commit: 45de34bbe3e1 perf buildid: add perfconfig option to specify buildid cache dir that added global buildid_dir variable that holds cache directory, but did not cleanup the debugdir copies. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1417460789-13874-3-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-buildid-cache.c11
-rw-r--r--tools/perf/util/build-id.c9
2 files changed, 7 insertions, 13 deletions
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index 70385756da63..29f24c071bc6 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -285,7 +285,6 @@ int cmd_buildid_cache(int argc, const char **argv,
285 struct str_node *pos; 285 struct str_node *pos;
286 int ret = 0; 286 int ret = 0;
287 bool force = false; 287 bool force = false;
288 char debugdir[PATH_MAX];
289 char const *add_name_list_str = NULL, 288 char const *add_name_list_str = NULL,
290 *remove_name_list_str = NULL, 289 *remove_name_list_str = NULL,
291 *missing_filename = NULL, 290 *missing_filename = NULL,
@@ -335,13 +334,11 @@ int cmd_buildid_cache(int argc, const char **argv,
335 334
336 setup_pager(); 335 setup_pager();
337 336
338 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir);
339
340 if (add_name_list_str) { 337 if (add_name_list_str) {
341 list = strlist__new(true, add_name_list_str); 338 list = strlist__new(true, add_name_list_str);
342 if (list) { 339 if (list) {
343 strlist__for_each(pos, list) 340 strlist__for_each(pos, list)
344 if (build_id_cache__add_file(pos->s, debugdir)) { 341 if (build_id_cache__add_file(pos->s, buildid_dir)) {
345 if (errno == EEXIST) { 342 if (errno == EEXIST) {
346 pr_debug("%s already in the cache\n", 343 pr_debug("%s already in the cache\n",
347 pos->s); 344 pos->s);
@@ -359,7 +356,7 @@ int cmd_buildid_cache(int argc, const char **argv,
359 list = strlist__new(true, remove_name_list_str); 356 list = strlist__new(true, remove_name_list_str);
360 if (list) { 357 if (list) {
361 strlist__for_each(pos, list) 358 strlist__for_each(pos, list)
362 if (build_id_cache__remove_file(pos->s, debugdir)) { 359 if (build_id_cache__remove_file(pos->s, buildid_dir)) {
363 if (errno == ENOENT) { 360 if (errno == ENOENT) {
364 pr_debug("%s wasn't in the cache\n", 361 pr_debug("%s wasn't in the cache\n",
365 pos->s); 362 pos->s);
@@ -380,7 +377,7 @@ int cmd_buildid_cache(int argc, const char **argv,
380 list = strlist__new(true, update_name_list_str); 377 list = strlist__new(true, update_name_list_str);
381 if (list) { 378 if (list) {
382 strlist__for_each(pos, list) 379 strlist__for_each(pos, list)
383 if (build_id_cache__update_file(pos->s, debugdir)) { 380 if (build_id_cache__update_file(pos->s, buildid_dir)) {
384 if (errno == ENOENT) { 381 if (errno == ENOENT) {
385 pr_debug("%s wasn't in the cache\n", 382 pr_debug("%s wasn't in the cache\n",
386 pos->s); 383 pos->s);
@@ -395,7 +392,7 @@ int cmd_buildid_cache(int argc, const char **argv,
395 } 392 }
396 393
397 if (kcore_filename && 394 if (kcore_filename &&
398 build_id_cache__add_kcore(kcore_filename, debugdir, force)) 395 build_id_cache__add_kcore(kcore_filename, buildid_dir, force))
399 pr_warning("Couldn't add %s\n", kcore_filename); 396 pr_warning("Couldn't add %s\n", kcore_filename);
400 397
401out: 398out:
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index e8d79e5bfaf7..0c72680a977f 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -410,21 +410,18 @@ int perf_session__cache_build_ids(struct perf_session *session)
410{ 410{
411 struct rb_node *nd; 411 struct rb_node *nd;
412 int ret; 412 int ret;
413 char debugdir[PATH_MAX];
414 413
415 if (no_buildid_cache) 414 if (no_buildid_cache)
416 return 0; 415 return 0;
417 416
418 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir); 417 if (mkdir(buildid_dir, 0755) != 0 && errno != EEXIST)
419
420 if (mkdir(debugdir, 0755) != 0 && errno != EEXIST)
421 return -1; 418 return -1;
422 419
423 ret = machine__cache_build_ids(&session->machines.host, debugdir); 420 ret = machine__cache_build_ids(&session->machines.host, buildid_dir);
424 421
425 for (nd = rb_first(&session->machines.guests); nd; nd = rb_next(nd)) { 422 for (nd = rb_first(&session->machines.guests); nd; nd = rb_next(nd)) {
426 struct machine *pos = rb_entry(nd, struct machine, rb_node); 423 struct machine *pos = rb_entry(nd, struct machine, rb_node);
427 ret |= machine__cache_build_ids(pos, debugdir); 424 ret |= machine__cache_build_ids(pos, buildid_dir);
428 } 425 }
429 return ret ? -1 : 0; 426 return ret ? -1 : 0;
430} 427}