linux/tools/perf/tests
Jiri Olsa 3c8a67f50a perf tools: Add kmod_path__parse function
Provides united way of parsing kernel module path
into several components.

The new kmod_path__parse function and few defines:

  int __kmod_path__parse(struct kmod_path *m, const char *path,
                         bool alloc_name, bool alloc_ext);

  #define kmod_path__parse(__m, __p)      __kmod_path__parse(__m, __p, false, false)
  #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
  #define kmod_path__parse_ext(__m, __p)  __kmod_path__parse(__m, __p, false, true)

parse kernel module @path and updates @m argument like:

  @comp - true if @path contains supported compression suffix,
          false otherwise
  @kmod - true if @path contains '.ko' suffix in right position,
          false otherwise
  @name - if (@alloc_name && @kmod) is true, it contains strdup-ed base name
          of the kernel module without suffixes, otherwise strudup-ed
          base name of @path
  @ext  - if (@alloc_ext && @comp) is true, it contains strdup-ed string
          the compression suffix

It returns 0 if there's no strdup error, -ENOMEM otherwise.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9t6eqg8j610r94l743hkntiv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-03-21 14:53:41 -03:00
..
attr perf tests: Fix attr tests size values to cope with machine state on interrupt ABI changes 2014-12-09 11:02:43 -03:00
attr.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
attr.py perf tools: Remove EOL whitespaces 2015-01-21 13:24:31 -03:00
bp_signal_overflow.c perf tools: Enable close-on-exec flag on perf file descriptor 2014-07-18 09:09:34 +02:00
bp_signal.c perf tools: Enable close-on-exec flag on perf file descriptor 2014-07-18 09:09:34 +02:00
Build perf tools: Add kmod_path__parse function 2015-03-21 14:53:41 -03:00
builtin-test.c perf tools: Add kmod_path__parse function 2015-03-21 14:53:41 -03:00
code-reading.c perf tests: Use thread->mg->machine 2014-10-29 10:32:47 -02:00
dso-data.c perf tests: Do not rely on dso__data_read_offset() to open dso 2015-02-06 11:46:35 +01:00
dwarf-unwind.c perf test: Fix dwarf unwind using libunwind. 2015-01-16 17:49:29 -03:00
evsel-roundtrip-name.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
evsel-tp-sched.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
fdarray.c tools lib fd array: Allow associating an integer cookie with each entry 2014-09-25 16:46:55 -03:00
hists_common.c perf tests: Add a test case for cumulating callchains 2014-06-01 14:35:11 +02:00
hists_common.h perf tests: Define and use symbolic names for fake symbols 2014-06-01 14:35:11 +02:00
hists_cumulate.c perf hists: Rename hist_entry__free to __delete 2015-01-21 13:24:31 -03:00
hists_filter.c perf report: Show progress bar for output resorting 2014-12-23 12:01:37 -03:00
hists_link.c perf evsel: Add hists helper 2014-10-09 13:13:41 -03:00
hists_output.c perf hists: Rename hist_entry__free to __delete 2015-01-21 13:24:31 -03:00
keep-tracking.c tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
kmod-path.c perf tools: Add kmod_path__parse function 2015-03-21 14:53:41 -03:00
make perf tools: Fix perf-read-vdsox32 not building and lib64 install dir 2015-03-19 13:38:05 -03:00
mmap-basic.c perf test: Use strerror_r instead of strerror 2014-08-15 13:07:28 -03:00
mmap-thread-lookup.c perf tools: A thread's machine can be found via thread->mg->machine 2014-10-29 10:32:46 -02:00
open-syscall-all-cpus.c perf tools: Make perf aware of tracefs 2015-02-11 12:37:08 -03:00
open-syscall-tp-fields.c perf evlist: Introduce poll method for common code idiom 2014-09-25 16:46:55 -03:00
open-syscall.c perf tools: Make perf aware of tracefs 2015-02-11 12:37:08 -03:00
parse-events.c perf tools: Make perf aware of tracefs 2015-02-11 12:37:08 -03:00
parse-no-sample-id-all.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
perf-record.c perf evlist: Introduce poll method for common code idiom 2014-09-25 16:46:55 -03:00
perf-targz-src-pkg perf tools: Add test for building detached source tarballs 2014-01-13 10:06:26 -03:00
perf-time-to-tsc.c perf tools: Move rdtsc() function 2014-07-23 11:48:11 -03:00
pmu.c perf tools: Let default config be defined for a PMU 2014-09-17 17:08:08 -03:00
python-use.c perf tests: Check python path on attr and binding test 2013-01-24 16:40:10 -03:00
rdpmc.c perf test: Use strerror_r instead of strerror 2014-08-15 13:07:28 -03:00
sample-parsing.c perf tests: Fix typo in sample-parsing.c 2015-01-22 17:03:01 -03:00
sw-clock.c perf test: Use strerror_r instead of strerror 2014-08-15 13:07:28 -03:00
switch-tracking.c perf tests: Add a test for tracking with sched_switch 2014-08-22 13:10:35 -03:00
task-exit.c perf evlist: Introduce poll method for common code idiom 2014-09-25 16:46:55 -03:00
tests.h perf tools: Add kmod_path__parse function 2015-03-21 14:53:41 -03:00
thread-mg-share.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
vmlinux-kallsyms.c perf tests: No need to set up ref_reloc_sym 2014-01-31 17:21:52 -03:00