diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-06-22 09:34:19 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-06-22 09:34:19 +0200 |
commit | 4330b439bbe16b48dd2fe9a379bd58a07b97aab8 (patch) | |
tree | 375958f5410db5095d172b21f02e5bb737fb97c6 /tools/perf/util/path.c | |
parent | 02469a95096a549508c5adf61d84a1d72851c85b (diff) | |
parent | 6745d8ea825966b0956c691cf7fccc13debedc39 (diff) |
Merge tag 'perf-core-for-mingo-20160621' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
New features:
- Add --dry-run option to 'perf record' to check if command line options can be
parsed, but not doing any recording (Wang Nan)
- Allow dumping the object files generated by llvm when processing eBPF
scriptlet events (Wang Nan)
- Add stackcollapse.py script to help generating flame graphs (Paolo Bonzini)
Documentation changes:
- Fix 'perf script' documentation of '-f' when it should be '-F' (Adrian Hunter)
Infrastructure changes:
- Fix write_backwards fallback when using a new tool on older kernels
without support for this feature (Arnaldo Carvalho de Melo)
- Remove some leftovers from the initial codebase copying from git
(Arnaldo Carvalho de Melo)
- List libelf-devel as an alternative, as this is how the libelf
development package is called on OpenSuSE (Jean Delvare)
- Rename __hists__add_entry to hists__add_entry (Jiri Olsa)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/path.c')
-rw-r--r-- | tools/perf/util/path.c | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index 3bf6bf82ff2d..cff8bf0f87e8 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c @@ -14,14 +14,8 @@ static char bad_path[] = "/bad-path/"; /* - * Two hacks: + * One hack: */ - -static const char *get_perf_dir(void) -{ - return "."; -} - static char *get_pathname(void) { static char pathname_array[4][PATH_MAX]; @@ -54,60 +48,3 @@ char *mkpath(const char *fmt, ...) return bad_path; return cleanup_path(pathname); } - -char *perf_path(const char *fmt, ...) -{ - const char *perf_dir = get_perf_dir(); - char *pathname = get_pathname(); - va_list args; - unsigned len; - - len = strlen(perf_dir); - if (len > PATH_MAX-100) - return bad_path; - memcpy(pathname, perf_dir, len); - if (len && perf_dir[len-1] != '/') - pathname[len++] = '/'; - va_start(args, fmt); - len += vsnprintf(pathname + len, PATH_MAX - len, fmt, args); - va_end(args); - if (len >= PATH_MAX) - return bad_path; - return cleanup_path(pathname); -} - -/* strip arbitrary amount of directory separators at end of path */ -static inline int chomp_trailing_dir_sep(const char *path, int len) -{ - while (len && is_dir_sep(path[len - 1])) - len--; - return len; -} - -/* - * If path ends with suffix (complete path components), returns the - * part before suffix (sans trailing directory separators). - * Otherwise returns NULL. - */ -char *strip_path_suffix(const char *path, const char *suffix) -{ - int path_len = strlen(path), suffix_len = strlen(suffix); - - while (suffix_len) { - if (!path_len) - return NULL; - - if (is_dir_sep(path[path_len - 1])) { - if (!is_dir_sep(suffix[suffix_len - 1])) - return NULL; - path_len = chomp_trailing_dir_sep(path, path_len); - suffix_len = chomp_trailing_dir_sep(suffix, suffix_len); - } - else if (path[--path_len] != suffix[--suffix_len]) - return NULL; - } - - if (path_len && !is_dir_sep(path[path_len - 1])) - return NULL; - return strndup(path, chomp_trailing_dir_sep(path, path_len)); -} |