aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/debugfs.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-11-16 09:55:59 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 07:11:04 -0500
commitc168fbfb93a1c4044287858c6784f0bd1f6cfe33 (patch)
tree517df56c9a1db500e1ccb2bab4a9eac4e9db93d0 /tools/perf/util/debugfs.c
parentc23205c8488f11cb9ebe7a7b5851a1d8a0171011 (diff)
perf tools: Eliminate duplicate code and use PATH_MAX consistently
No need for multiple definitions for STR() and die(), also use SuSv2's PATH_MAX instead of adding MAX_PATH. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-qpujjkw7u0bf0tr4wt55cr9y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/debugfs.c')
-rw-r--r--tools/perf/util/debugfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/util/debugfs.c b/tools/perf/util/debugfs.c
index a88fefc0cc0a..680be3460e86 100644
--- a/tools/perf/util/debugfs.c
+++ b/tools/perf/util/debugfs.c
@@ -2,8 +2,10 @@
2#include "debugfs.h" 2#include "debugfs.h"
3#include "cache.h" 3#include "cache.h"
4 4
5#include <sys/mount.h>
6
5static int debugfs_premounted; 7static int debugfs_premounted;
6static char debugfs_mountpoint[MAX_PATH+1]; 8static char debugfs_mountpoint[PATH_MAX + 1];
7 9
8static const char *debugfs_known_mountpoints[] = { 10static const char *debugfs_known_mountpoints[] = {
9 "/sys/kernel/debug/", 11 "/sys/kernel/debug/",
@@ -64,9 +66,7 @@ const char *debugfs_find_mountpoint(void)
64 if (fp == NULL) 66 if (fp == NULL)
65 die("Can't open /proc/mounts for read"); 67 die("Can't open /proc/mounts for read");
66 68
67 while (fscanf(fp, "%*s %" 69 while (fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n",
68 STR(MAX_PATH)
69 "s %99s %*s %*d %*d\n",
70 debugfs_mountpoint, type) == 2) { 70 debugfs_mountpoint, type) == 2) {
71 if (strcmp(type, "debugfs") == 0) 71 if (strcmp(type, "debugfs") == 0)
72 break; 72 break;
@@ -158,7 +158,7 @@ int debugfs_umount(void)
158 158
159int debugfs_write(const char *entry, const char *value) 159int debugfs_write(const char *entry, const char *value)
160{ 160{
161 char path[MAX_PATH+1]; 161 char path[PATH_MAX + 1];
162 int ret, count; 162 int ret, count;
163 int fd; 163 int fd;
164 164
@@ -203,7 +203,7 @@ int debugfs_write(const char *entry, const char *value)
203 */ 203 */
204int debugfs_read(const char *entry, char *buffer, size_t size) 204int debugfs_read(const char *entry, char *buffer, size_t size)
205{ 205{
206 char path[MAX_PATH+1]; 206 char path[PATH_MAX + 1];
207 int ret; 207 int ret;
208 int fd; 208 int fd;
209 209