From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH v2 13/14] perf tools: Move tools/lib/string.c to libapi
Date: Mon, 7 Dec 2015 22:21:51 -0600 [thread overview]
Message-ID: <42050ef45c18ee069c4993f2853846cfd9248281.1449548395.git.jpoimboe@redhat.com> (raw)
In-Reply-To: <cover.1449548395.git.jpoimboe@redhat.com>
Get rid of libstring and move tools/lib/string.c to libapi where it can
more easily be used by other tools.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
tools/lib/api/Build | 1 +
tools/lib/api/string/Build | 1 +
tools/lib/{ => api/string}/string.c | 7 ++++---
tools/{include/linux => lib/api/string}/string.h | 10 +++++-----
tools/perf/MANIFEST | 2 --
tools/perf/builtin-kmem.c | 2 +-
tools/perf/util/Build | 6 ------
tools/perf/util/auxtrace.c | 2 +-
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/intel-pt-decoder/insn.c | 2 +-
tools/perf/util/map.c | 2 +-
tools/perf/util/ordered-events.c | 2 +-
tools/perf/util/parse-options.c | 2 +-
tools/perf/util/util.h | 2 +-
14 files changed, 19 insertions(+), 24 deletions(-)
create mode 100644 tools/lib/api/string/Build
rename tools/lib/{ => api/string}/string.c (93%)
rename tools/{include/linux => lib/api/string}/string.h (66%)
diff --git a/tools/lib/api/Build b/tools/lib/api/Build
index e8b8a23..9e3967e 100644
--- a/tools/lib/api/Build
+++ b/tools/lib/api/Build
@@ -1,3 +1,4 @@
libapi-y += fd/
libapi-y += fs/
libapi-y += cpu.o
+libapi-y += string/
diff --git a/tools/lib/api/string/Build b/tools/lib/api/string/Build
new file mode 100644
index 0000000..7707d3d
--- /dev/null
+++ b/tools/lib/api/string/Build
@@ -0,0 +1 @@
+libapi-y += string.o
diff --git a/tools/lib/string.c b/tools/lib/api/string/string.c
similarity index 93%
rename from tools/lib/string.c
rename to tools/lib/api/string/string.c
index 3366582..3140ba3 100644
--- a/tools/lib/string.c
+++ b/tools/lib/api/string/string.c
@@ -1,5 +1,5 @@
/*
- * linux/tools/lib/string.c
+ * linux/tools/lib/api/string/string.c
*
* Copied from linux/lib/string.c, where it is:
*
@@ -15,8 +15,9 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <linux/string.h>
-#include <linux/compiler.h>
+#include "string.h"
+
+#define __weak __attribute__((weak))
/**
* memdup - duplicate region of memory
diff --git a/tools/include/linux/string.h b/tools/lib/api/string/string.h
similarity index 66%
rename from tools/include/linux/string.h
rename to tools/lib/api/string/string.h
index eae1d87..74bd4fd 100644
--- a/tools/include/linux/string.h
+++ b/tools/lib/api/string/string.h
@@ -1,8 +1,8 @@
-#ifndef _TOOLS_LINUX_STRING_H_
-#define _TOOLS_LINUX_STRING_H_
+#ifndef _API_STRING_H
+#define _API_STRING_H
-
-#include <linux/types.h> /* for size_t */
+#include <stddef.h>
+#include <stdbool.h>
void *memdup(const void *src, size_t len);
@@ -13,4 +13,4 @@ int strtobool(const char *s, bool *res);
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif
-#endif /* _LINUX_STRING_H_ */
+#endif /* _API_STRING_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 2562eac..39c38cb 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -22,7 +22,6 @@ tools/lib/api
tools/lib/bpf
tools/lib/hweight.c
tools/lib/rbtree.c
-tools/lib/string.c
tools/lib/symbol/kallsyms.c
tools/lib/symbol/kallsyms.h
tools/lib/util/find_next_bit.c
@@ -51,7 +50,6 @@ tools/include/linux/log2.h
tools/include/linux/poison.h
tools/include/linux/rbtree.h
tools/include/linux/rbtree_augmented.h
-tools/include/linux/string.h
tools/include/linux/types.h
tools/include/linux/err.h
include/asm-generic/bitops/arch_hweight.h
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 1c3d3d9..cdf487b 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -19,7 +19,7 @@
#include "util/debug.h"
#include <linux/rbtree.h>
-#include <linux/string.h>
+#include <api/string/string.h>
#include <locale.h>
#include <regex.h>
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 99b3dae..02d3a54 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -20,7 +20,6 @@ libperf-y += parse-events.o
libperf-y += perf_regs.o
libperf-y += path.o
libperf-y += rbtree.o
-libperf-y += libstring.o
libperf-y += bitmap.o
libperf-y += hweight.o
libperf-y += run-command.o
@@ -141,7 +140,6 @@ $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
CFLAGS_find_next_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
-CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
CFLAGS_parse-events.o += -Wno-redundant-decls
@@ -157,10 +155,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
$(call rule_mkdir)
$(call if_changed_dep,cc_o_c)
-$(OUTPUT)util/libstring.o: ../lib/string.c FORCE
- $(call rule_mkdir)
- $(call if_changed_dep,cc_o_c)
-
$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
$(call rule_mkdir)
$(call if_changed_dep,cc_o_c)
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 7f10430..cc83262 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -22,7 +22,7 @@
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/log2.h>
-#include <linux/string.h>
+#include <api/string/string.h>
#include <sys/param.h>
#include <stdlib.h>
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 540a7ef..5a99b6a 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -8,7 +8,7 @@
#include <linux/bpf.h>
#include <bpf/libbpf.h>
#include <linux/err.h>
-#include <linux/string.h>
+#include <api/string/string.h>
#include "perf.h"
#include "debug.h"
#include "bpf-loader.h"
diff --git a/tools/perf/util/intel-pt-decoder/insn.c b/tools/perf/util/intel-pt-decoder/insn.c
index 47314a6..bcf3a8e 100644
--- a/tools/perf/util/intel-pt-decoder/insn.c
+++ b/tools/perf/util/intel-pt-decoder/insn.c
@@ -19,7 +19,7 @@
*/
#ifdef __KERNEL__
-#include <linux/string.h>
+#include <api/string/string.h>
#else
#include <string.h>
#endif
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 93d9f1c..c9f716d 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -14,7 +14,7 @@
#include "util.h"
#include "debug.h"
#include "machine.h"
-#include <linux/string.h>
+#include <api/string/string.h>
static void __maps__insert(struct maps *maps, struct map *map);
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index b1b9e23..867ae98 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -1,6 +1,6 @@
#include <linux/list.h>
#include <linux/compiler.h>
-#include <linux/string.h>
+#include <api/string/string.h>
#include "ordered-events.h"
#include "session.h"
#include "asm/bug.h"
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 735c8c8..8d70c1b 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -1,7 +1,7 @@
#include "util.h"
#include "parse-options.h"
#include "header.h"
-#include <linux/string.h>
+#include <api/string/string.h>
#define OPT_SHORT 1
#define OPT_UNSET 2
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 2c6db35..f1c07f6 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -3,7 +3,7 @@
#include "compat-util.h"
-#include <linux/string.h>
+#include <api/string/string.h>
#include "../perf.h"
#include "abspath.h"
#include "alias.h"
--
2.4.3
next prev parent reply other threads:[~2015-12-08 4:24 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 4:21 [PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 01/14] perf: Fix 'make clean' Josh Poimboeuf
2015-12-08 17:40 ` Jiri Olsa
2015-12-08 18:40 ` Jiri Olsa
2015-12-08 18:49 ` Josh Poimboeuf
2015-12-08 18:46 ` Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 02/14] perf: Use -iquote for local include paths Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 03/14] perf: Split up util.h Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 04/14] perf: Move term functions out of util.c Josh Poimboeuf
2015-12-09 15:53 ` Arnaldo Carvalho de Melo
2015-12-10 8:18 ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 05/14] perf: Remove unused pager_use_color variable Josh Poimboeuf
2015-12-09 15:43 ` Arnaldo Carvalho de Melo
2015-12-10 8:18 ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 06/14] perf: Split up cache.h Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 07/14] perf: Remove cache.h Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 08/14] perf: Save cmdline arguments earlier Josh Poimboeuf
2015-12-10 8:18 ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 09/14] perf: Remove check for unused PERF_PAGER_IN_USE Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 10/14] perf: Move cmd_version() to builtin-version.c Josh Poimboeuf
2015-12-10 8:19 ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 11/14] perf: Move help_unknown_cmd() to its own file Josh Poimboeuf
2015-12-08 4:21 ` [PATCH v2 12/14] perf tools: Move strlcpy() to tools/lib/string.c Josh Poimboeuf
2015-12-08 4:21 ` Josh Poimboeuf [this message]
2015-12-08 4:21 ` [PATCH v2 14/14] perf tools: Move subcommand framework and related utils to libapi Josh Poimboeuf
2015-12-08 18:16 ` Jiri Olsa
2015-12-08 18:49 ` Josh Poimboeuf
2015-12-08 19:09 ` Arnaldo Carvalho de Melo
2015-12-08 19:17 ` Josh Poimboeuf
2015-12-08 19:40 ` Arnaldo Carvalho de Melo
2015-12-08 21:48 ` Josh Poimboeuf
2015-12-08 22:27 ` Arnaldo Carvalho de Melo
2015-12-08 23:07 ` Josh Poimboeuf
2015-12-09 8:03 ` Ingo Molnar
2015-12-09 12:33 ` Josh Poimboeuf
2015-12-09 15:58 ` Arnaldo Carvalho de Melo
2015-12-09 18:59 ` Josh Poimboeuf
2015-12-10 1:40 ` Namhyung Kim
2015-12-10 14:54 ` Josh Poimboeuf
2015-12-10 21:35 ` Josh Poimboeuf
2015-12-11 11:21 ` Arnaldo Carvalho de Melo
2015-12-10 12:55 ` Arnaldo Carvalho de Melo
2015-12-10 15:15 ` Josh Poimboeuf
2015-12-10 1:58 ` Namhyung Kim
2015-12-10 2:00 ` [PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools Namhyung Kim
2015-12-10 15:11 ` Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42050ef45c18ee069c4993f2853846cfd9248281.1449548395.git.jpoimboe@redhat.com \
--to=jpoimboe@redhat.com \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).