From c168fbfb93a1c4044287858c6784f0bd1f6cfe33 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 16 Nov 2011 12:55:59 -0200 Subject: 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 Cc: Frederic Weisbecker Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-qpujjkw7u0bf0tr4wt55cr9y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/debugfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/perf/util/debugfs.c') 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 + 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; -- cgit v1.2.3-59-g8ed1b