[PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools

From: Josh Poimboeuf
Date: Mon Dec 07 2015 - 23:23:58 EST


Ingo suggested that I factor out the perf subcommand functionality
(originally copied from git) into tools/lib so that it can be used by
stacktool[*] and possibly others.

All the subcommand option handling files have been moved into libapi,
including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c,
and their dependencies. Since several of the dependencies are more
general-purpose "utilities" which aren't directly related to
subcommands, I put everything in 'tools/lib/api/util'. They're linked
into perf as part of the libapi.a library.

Patches 1-13 do some cleanups and splitting up of the code in
preparation for the move.

Patch 14 does the actual moving of the files into tools/lib/api/util.

Based on tip/perf/core.

[*] https://lkml.kernel.org/r/cover.1445443144.git.jpoimboe@xxxxxxxxxx

v2:
- Fix 'make clean' to remove tests/llvm-src-*.c and other leftover
files
- Fix description for "Move tools/lib/string.c to libapi" patch

Josh Poimboeuf (14):
perf: Fix 'make clean'
perf: Use -iquote for local include paths
perf: Split up util.h
perf: Move term functions out of util.c
perf: Remove unused pager_use_color variable
perf: Split up cache.h
perf: Remove cache.h
perf: Save cmdline arguments earlier
perf: Remove check for unused PERF_PAGER_IN_USE
perf: Move cmd_version() to builtin-version.c
perf: Move help_unknown_cmd() to its own file
perf tools: Move strlcpy() to tools/lib/string.c
perf tools: Move tools/lib/string.c to libapi
perf tools: Move subcommand framework and related utils to libapi

tools/include/asm-generic/bitops/__fls.h | 2 +-
tools/include/asm-generic/bitops/fls.h | 2 +-
tools/include/asm-generic/bitops/fls64.h | 2 +-
tools/lib/api/Build | 2 +
tools/lib/api/Makefile | 6 +-
tools/lib/api/string/Build | 1 +
tools/lib/{ => api/string}/string.c | 24 +-
tools/{include/linux => lib/api/string}/string.h | 15 +-
tools/lib/api/util/Build | 13 +
tools/{perf => lib/api}/util/abspath.c | 6 +-
tools/lib/api/util/abspath.h | 11 +
tools/lib/api/util/cfg.c | 12 +
tools/lib/api/util/cfg.h | 15 +
tools/lib/api/util/compat-util.h | 129 +++++++++
tools/{perf => lib/api}/util/ctype.c | 3 +-
tools/lib/api/util/ctype.h | 52 ++++
tools/{perf => lib/api}/util/exec_cmd.c | 42 +--
tools/{perf => lib/api}/util/exec_cmd.h | 18 +-
tools/{perf => lib/api}/util/help.c | 134 ++-------
tools/{perf => lib/api}/util/help.h | 3 +
tools/{perf => lib/api}/util/pager.c | 14 +-
tools/lib/api/util/pager.h | 7 +
tools/{perf => lib/api}/util/parse-options.c | 30 +-
tools/{perf => lib/api}/util/parse-options.h | 10 +-
tools/{perf => lib/api}/util/run-command.c | 12 +-
tools/{perf => lib/api}/util/run-command.h | 10 +-
tools/{perf => lib/api}/util/sigchain.c | 4 +-
tools/{perf => lib/api}/util/sigchain.h | 6 +-
tools/{perf => lib/api}/util/strbuf.c | 6 +-
tools/{perf => lib/api}/util/strbuf.h | 8 +-
tools/lib/api/util/term.c | 36 +++
tools/lib/api/util/term.h | 7 +
tools/{perf => lib/api}/util/usage.c | 4 +-
tools/lib/api/util/usage.h | 23 ++
tools/{perf => lib/api}/util/wrapper.c | 4 +-
.../{perf/util/cache.h => lib/api/util/wrapper.h} | 65 +----
tools/perf/Build | 3 +-
tools/perf/MANIFEST | 2 -
tools/perf/Makefile.perf | 13 +-
tools/perf/arch/x86/util/intel-pt.c | 2 +-
tools/perf/bench/futex-hash.c | 2 +-
tools/perf/bench/futex-lock-pi.c | 2 +-
tools/perf/bench/futex-requeue.c | 2 +-
tools/perf/bench/futex-wake-parallel.c | 2 +-
tools/perf/bench/futex-wake.c | 2 +-
tools/perf/bench/mem-functions.c | 2 +-
tools/perf/bench/numa.c | 2 +-
tools/perf/bench/sched-messaging.c | 2 +-
tools/perf/bench/sched-pipe.c | 2 +-
tools/perf/builtin-annotate.c | 3 +-
tools/perf/builtin-bench.c | 2 +-
tools/perf/builtin-buildid-cache.c | 4 +-
tools/perf/builtin-buildid-list.c | 4 +-
tools/perf/builtin-config.c | 3 +-
tools/perf/builtin-data.c | 2 +-
tools/perf/builtin-evlist.c | 2 +-
tools/perf/builtin-help.c | 11 +-
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kmem.c | 5 +-
tools/perf/builtin-kvm.c | 3 +-
tools/perf/builtin-list.c | 4 +-
tools/perf/builtin-lock.c | 3 +-
tools/perf/builtin-mem.c | 2 +-
tools/perf/builtin-probe.c | 2 +-
tools/perf/builtin-record.c | 2 +-
tools/perf/builtin-report.c | 3 +-
tools/perf/builtin-sched.c | 3 +-
tools/perf/builtin-script.c | 13 +-
tools/perf/builtin-stat.c | 2 +-
tools/perf/builtin-timechart.c | 3 +-
tools/perf/builtin-top.c | 3 +-
tools/perf/builtin-trace.c | 4 +-
tools/perf/builtin-version.c | 9 +
tools/perf/builtin.h | 2 +-
tools/perf/config/Makefile | 4 +-
tools/perf/perf.c | 30 +-
tools/perf/perf.h | 13 +
tools/perf/tests/Build | 6 +-
tools/perf/tests/attr.c | 4 +-
tools/perf/tests/bpf.c | 4 +-
tools/perf/tests/builtin-test.c | 2 +-
tools/perf/tests/llvm.c | 4 +-
tools/perf/ui/browser.c | 1 -
tools/perf/ui/browsers/header.c | 2 +-
tools/perf/ui/gtk/browser.c | 2 +-
tools/perf/ui/gtk/hists.c | 2 +-
tools/perf/ui/gtk/setup.c | 2 +-
tools/perf/ui/helpline.h | 2 +-
tools/perf/ui/progress.c | 2 +-
tools/perf/ui/setup.c | 7 +-
tools/perf/ui/tui/progress.c | 2 +-
tools/perf/ui/tui/setup.c | 1 -
tools/perf/ui/tui/util.c | 1 -
tools/perf/ui/ui.h | 1 +
tools/perf/util/Build | 20 +-
tools/perf/util/alias.c | 2 +-
tools/perf/util/alias.h | 7 +
tools/perf/util/annotate.c | 1 -
tools/perf/util/auxtrace.c | 4 +-
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/cgroup.c | 2 +-
tools/perf/util/color.c | 4 +-
tools/perf/util/config.c | 3 +-
tools/perf/util/config.h | 18 ++
tools/perf/util/debug.c | 1 -
tools/perf/util/env.c | 9 -
tools/perf/util/environment.c | 8 -
tools/perf/util/evlist.c | 2 +-
tools/perf/util/header.c | 2 +-
tools/perf/util/help-unknown-cmd.c | 103 +++++++
tools/perf/util/help-unknown-cmd.h | 0
tools/perf/util/intel-pt-decoder/insn.c | 2 +-
.../perf/util/intel-pt-decoder/intel-pt-decoder.c | 1 -
tools/perf/util/levenshtein.c | 2 +-
tools/perf/util/llvm-utils.c | 1 -
tools/perf/util/lzma.h | 8 +
tools/perf/util/map.c | 2 +-
tools/perf/util/ordered-events.c | 2 +-
tools/perf/util/parse-branch-options.c | 2 +-
tools/perf/util/parse-events.c | 5 +-
tools/perf/util/parse-regs-options.c | 2 +-
tools/perf/util/path.c | 20 +-
tools/perf/util/path.h | 12 +
tools/perf/util/probe-event.c | 1 -
tools/perf/util/probe-file.c | 1 -
tools/perf/util/python-ext-sources | 1 -
tools/perf/util/quote.c | 2 +-
tools/perf/util/sort.h | 3 +-
tools/perf/util/srcline.h | 16 ++
tools/perf/util/string.h | 34 +++
tools/perf/util/thread.h | 4 +-
tools/perf/util/util.c | 34 ---
tools/perf/util/util.h | 314 ++-------------------
tools/perf/util/zlib.h | 8 +
134 files changed, 864 insertions(+), 765 deletions(-)
create mode 100644 tools/lib/api/string/Build
rename tools/lib/{ => api/string}/string.c (73%)
rename tools/{include/linux => lib/api/string}/string.h (23%)
create mode 100644 tools/lib/api/util/Build
rename tools/{perf => lib/api}/util/abspath.c (90%)
create mode 100644 tools/lib/api/util/abspath.h
create mode 100644 tools/lib/api/util/cfg.c
create mode 100644 tools/lib/api/util/cfg.h
create mode 100644 tools/lib/api/util/compat-util.h
rename tools/{perf => lib/api}/util/ctype.c (97%)
create mode 100644 tools/lib/api/util/ctype.h
rename tools/{perf => lib/api}/util/exec_cmd.c (72%)
rename tools/{perf => lib/api}/util/exec_cmd.h (14%)
rename tools/{perf => lib/api}/util/help.c (59%)
rename tools/{perf => lib/api}/util/help.h (85%)
rename tools/{perf => lib/api}/util/pager.c (88%)
create mode 100644 tools/lib/api/util/pager.h
rename tools/{perf => lib/api}/util/parse-options.c (97%)
rename tools/{perf => lib/api}/util/parse-options.h (98%)
rename tools/{perf => lib/api}/util/run-command.c (96%)
rename tools/{perf => lib/api}/util/run-command.h (87%)
rename tools/{perf => lib/api}/util/sigchain.c (93%)
rename tools/{perf => lib/api}/util/sigchain.h (53%)
rename tools/{perf => lib/api}/util/strbuf.c (97%)
rename tools/{perf => lib/api}/util/strbuf.h (95%)
create mode 100644 tools/lib/api/util/term.c
create mode 100644 tools/lib/api/util/term.h
rename tools/{perf => lib/api}/util/usage.c (97%)
create mode 100644 tools/lib/api/util/usage.h
rename tools/{perf => lib/api}/util/wrapper.c (92%)
rename tools/{perf/util/cache.h => lib/api/util/wrapper.h} (22%)
create mode 100644 tools/perf/builtin-version.c
create mode 100644 tools/perf/util/alias.h
create mode 100644 tools/perf/util/config.h
delete mode 100644 tools/perf/util/environment.c
create mode 100644 tools/perf/util/help-unknown-cmd.c
create mode 100644 tools/perf/util/help-unknown-cmd.h
create mode 100644 tools/perf/util/lzma.h
create mode 100644 tools/perf/util/path.h
create mode 100644 tools/perf/util/srcline.h
create mode 100644 tools/perf/util/string.h
create mode 100644 tools/perf/util/zlib.h

--
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/