aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2013-02-20 10:32:27 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-03-15 12:05:58 -0400
commitfed1208841f5db92cc3bede4b1004e9e986d843e (patch)
tree7b71d0db9b3a5e3a69372b91954c519f66e927b7
parent861e10be08c69808065d755d3e3cab5d520a2d32 (diff)
perf tools: Remove a write-only variable in the debugfs code
debugfs_premounted is written-to only so drop it. This functionality is covered by debugfs_found now. Make it a bool while at it. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1361374353-30385-2-git-send-email-bp@alien8.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/debugfs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/perf/util/debugfs.c b/tools/perf/util/debugfs.c
index dd8b19319c03..e55495c7823a 100644
--- a/tools/perf/util/debugfs.c
+++ b/tools/perf/util/debugfs.c
@@ -5,7 +5,6 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <sys/mount.h> 6#include <sys/mount.h>
7 7
8static int debugfs_premounted;
9char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; 8char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
10char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events"; 9char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
11 10
@@ -15,7 +14,7 @@ static const char *debugfs_known_mountpoints[] = {
15 0, 14 0,
16}; 15};
17 16
18static int debugfs_found; 17static bool debugfs_found;
19 18
20/* find the path to the mounted debugfs */ 19/* find the path to the mounted debugfs */
21const char *debugfs_find_mountpoint(void) 20const char *debugfs_find_mountpoint(void)
@@ -30,7 +29,7 @@ const char *debugfs_find_mountpoint(void)
30 ptr = debugfs_known_mountpoints; 29 ptr = debugfs_known_mountpoints;
31 while (*ptr) { 30 while (*ptr) {
32 if (debugfs_valid_mountpoint(*ptr) == 0) { 31 if (debugfs_valid_mountpoint(*ptr) == 0) {
33 debugfs_found = 1; 32 debugfs_found = true;
34 strcpy(debugfs_mountpoint, *ptr); 33 strcpy(debugfs_mountpoint, *ptr);
35 return debugfs_mountpoint; 34 return debugfs_mountpoint;
36 } 35 }
@@ -52,7 +51,7 @@ const char *debugfs_find_mountpoint(void)
52 if (strcmp(type, "debugfs") != 0) 51 if (strcmp(type, "debugfs") != 0)
53 return NULL; 52 return NULL;
54 53
55 debugfs_found = 1; 54 debugfs_found = true;
56 55
57 return debugfs_mountpoint; 56 return debugfs_mountpoint;
58} 57}
@@ -82,10 +81,8 @@ static void debugfs_set_tracing_events_path(const char *mountpoint)
82char *debugfs_mount(const char *mountpoint) 81char *debugfs_mount(const char *mountpoint)
83{ 82{
84 /* see if it's already mounted */ 83 /* see if it's already mounted */
85 if (debugfs_find_mountpoint()) { 84 if (debugfs_find_mountpoint())
86 debugfs_premounted = 1;
87 goto out; 85 goto out;
88 }
89 86
90 /* if not mounted and no argument */ 87 /* if not mounted and no argument */
91 if (mountpoint == NULL) { 88 if (mountpoint == NULL) {
@@ -100,7 +97,7 @@ char *debugfs_mount(const char *mountpoint)
100 return NULL; 97 return NULL;
101 98
102 /* save the mountpoint */ 99 /* save the mountpoint */
103 debugfs_found = 1; 100 debugfs_found = true;
104 strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint)); 101 strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
105out: 102out:
106 debugfs_set_tracing_events_path(debugfs_mountpoint); 103 debugfs_set_tracing_events_path(debugfs_mountpoint);