lkml.org 
[lkml]   [2014]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/37] perf tools: Add multi file interface to perf_data_file
On Wed, Dec 24, 2014 at 04:15:00PM +0900, Namhyung Kim wrote:

SNIP

> #endif /* __PERF_DATA_H */
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index d5eab3f3323f..a5046d52e311 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -72,6 +72,49 @@ int mkdir_p(char *path, mode_t mode)
> return (stat(path, &st) && mkdir(path, mode)) ? -1 : 0;
> }
>
> +int rm_rf(char *path)
> +{
> + DIR *dir;
> + int ret = 0;
> + struct dirent *d;
> + char namebuf[PATH_MAX];
> +
> + dir = opendir(path);
> + if (dir == NULL)
> + return 0;
> +
> + while ((d = readdir(dir)) != NULL && !ret) {
> + struct stat statbuf;
> +
> + if (d->d_name[0] == '.')
> + continue;

Could you check for '.' and for '..' to support '.*' removal?

I know tha we will probably not have any '.*' files in perf.data.dir,
but this function could be used later like for total cache clean ;-)

also please submit 'rm_rf' in separate patch

thanks,
jirka


\
 
 \ /
  Last update: 2014-12-25 23:21    [W:0.323 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site