[PATCH 12/25] perf tools: Move get_current_dir_name() cond prototype out of util.h

From: Arnaldo Carvalho de Melo
Date: Tue Jul 09 2019 - 14:32:40 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

And in a separate header, so that we erode util.h a bit more.

Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Link: https://lkml.kernel.org/n/tip-xpzvuu9d0gei9jl9bkzgobln@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/get_current_dir_name.c | 6 +++---
tools/perf/util/get_current_dir_name.h | 8 ++++++++
tools/perf/util/namespaces.c | 1 +
tools/perf/util/util.h | 4 ----
4 files changed, 12 insertions(+), 7 deletions(-)
create mode 100644 tools/perf/util/get_current_dir_name.h

diff --git a/tools/perf/util/get_current_dir_name.c b/tools/perf/util/get_current_dir_name.c
index 267aa609a582..01f32f26552d 100644
--- a/tools/perf/util/get_current_dir_name.c
+++ b/tools/perf/util/get_current_dir_name.c
@@ -1,8 +1,8 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
+// SPDX-License-Identifier: LGPL-2.1
+// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
//
#ifndef HAVE_GET_CURRENT_DIR_NAME
-#include "util.h"
+#include "get_current_dir_name.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>
diff --git a/tools/perf/util/get_current_dir_name.h b/tools/perf/util/get_current_dir_name.h
new file mode 100644
index 000000000000..69f7d5537d32
--- /dev/null
+++ b/tools/perf/util/get_current_dir_name.h
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: LGPL-2.1
+// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
+//
+#ifndef __PERF_GET_CURRENT_DIR_NAME_H
+#ifndef HAVE_GET_CURRENT_DIR_NAME
+char *get_current_dir_name(void);
+#endif // HAVE_GET_CURRENT_DIR_NAME
+#endif // __PERF_GET_CURRENT_DIR_NAME_H
diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
index 023c4efd788d..fda2fa1e8819 100644
--- a/tools/perf/util/namespaces.c
+++ b/tools/perf/util/namespaces.c
@@ -7,6 +7,7 @@
#include "namespaces.h"
#include "util.h"
#include "event.h"
+#include "get_current_dir_name.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 59fe33708090..cfc4d85bbd42 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -59,10 +59,6 @@ int fetch_kernel_version(unsigned int *puint,

const char *perf_tip(const char *dirpath);

-#ifndef HAVE_GET_CURRENT_DIR_NAME
-char *get_current_dir_name(void);
-#endif
-
#ifndef HAVE_SCHED_GETCPU_SUPPORT
int sched_getcpu(void);
#endif
--
2.21.0