Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf tools: Add rm_rf_perf_data function

To remove perf.data including the directory, with checking on expected
files and no other directories inside.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Suggested-by: Andi Kleen <ak@linux.intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20190224190656.30163-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
c69e4c37 cdb6b023

+12
+11
tools/perf/util/util.c
··· 202 202 return rmdir(path); 203 203 } 204 204 205 + int rm_rf_perf_data(const char *path) 206 + { 207 + const char *pat[] = { 208 + "header", 209 + "data.*", 210 + NULL, 211 + }; 212 + 213 + return rm_rf_depth_pat(path, 0, pat); 214 + } 215 + 205 216 int rm_rf(const char *path) 206 217 { 207 218 return rm_rf_depth_pat(path, INT_MAX, NULL);
+1
tools/perf/util/util.h
··· 31 31 32 32 int mkdir_p(char *path, mode_t mode); 33 33 int rm_rf(const char *path); 34 + int rm_rf_perf_data(const char *path); 34 35 struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *)); 35 36 bool lsdir_no_dot_filter(const char *name, struct dirent *d); 36 37 int copyfile(const char *from, const char *to);