lkml.org 
[lkml]   [2017]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH V3 4/6] perf tools: add perf_data_file__open_tmp
Date
> SNIP
>
> > > > ssize_t perf_data_file__write(struct perf_data_file *file, diff
> > > > --git a/tools/perf/util/data.h b/tools/perf/util/data.h index
> > > > ae510ce..892b3d5 100644
> > > > --- a/tools/perf/util/data.h
> > > > +++ b/tools/perf/util/data.h
> > > > @@ -10,6 +10,7 @@ enum perf_data_mode {
> > > >
> > > > struct perf_data_file {
> > > > const char *path;
> > > > + char *tmp_path;
> > >
> > > could we add is_tmp instead of new path pointer and keep the path
> > > for the name..?
> >
> > The 'path' is const char. I think it's not good for tmp file which
> > generate the file name in real time.
>
> then change path to 'char *' ? I just dont think having
> 2 name pointers for path will keep this simple
>

I tried, but it will impact almost all the perf tools.
The input/output file name is const char*, which means that the file
name should not be change.
I just don't think it's right to cast it to char *.

How about introducing a new dedicated struct for tmp files only?
struct perf_data_tmp_file {
chat *tmp_patch
int fd
}

And three interfaces to open, write and close.
perf_data_file__open_tmp()
perf_data_file__write_tmp()
perf_data_file__close_tmp()

Thanks,
Kan

\
 
 \ /
  Last update: 2017-10-23 20:05    [W:1.395 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site