aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/debugfs.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-11-16 12:55:59 -0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 10:11:04 -0200
commitc168fbfb93a1c4044287858c6784f0bd1f6cfe33 (patch)
tree517df56c9a1db500e1ccb2bab4a9eac4e9db93d0 /tools/perf/util/debugfs.c
parentMerge branch 'core' of git://amd64.org/linux/rric into perf/core (diff)
downloadlinux-dev-c168fbfb93a1c4044287858c6784f0bd1f6cfe33.tar.xz
linux-dev-c168fbfb93a1c4044287858c6784f0bd1f6cfe33.zip
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 @@
#include "debugfs.h"
#include "cache.h"
+#include <sys/mount.h>
+
static int debugfs_premounted;
-static char debugfs_mountpoint[MAX_PATH+1];
+static char debugfs_mountpoint[PATH_MAX + 1];
static const char *debugfs_known_mountpoints[] = {
"/sys/kernel/debug/",
@@ -64,9 +66,7 @@ const char *debugfs_find_mountpoint(void)
if (fp == NULL)
die("Can't open /proc/mounts for read");
- while (fscanf(fp, "%*s %"
- STR(MAX_PATH)
- "s %99s %*s %*d %*d\n",
+ while (fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n",
debugfs_mountpoint, type) == 2) {
if (strcmp(type, "debugfs") == 0)
break;
@@ -158,7 +158,7 @@ int debugfs_umount(void)
int debugfs_write(const char *entry, const char *value)
{
- char path[MAX_PATH+1];
+ char path[PATH_MAX + 1];
int ret, count;
int fd;
@@ -203,7 +203,7 @@ int debugfs_write(const char *entry, const char *value)
*/
int debugfs_read(const char *entry, char *buffer, size_t size)
{
- char path[MAX_PATH+1];
+ char path[PATH_MAX + 1];
int ret;
int fd;