Re: [PATCH 6/8] trace-cmd output: Set file_state of output handle after copy of headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Mar 2021 19:35:11 +0200
Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:

> On Tue, Mar 2, 2021 at 5:48 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > On Tue, 2 Mar 2021 16:51:56 +0200
> > Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:
> >  
> > > >         handle->file_state = state;  
> > >
> > > The output handle should have the same state as the input handle,
> > > so we can just have:
> > >
> > >       handle->file_state = tracecmd_get_file_state(ihandle);
> > >
> > > There is exactly the same use case in tracecmd_get_output_handle_fd(),
> > > where the out handle is built on a partially written file.  
> >
> > The above is pretty much exactly what I did, but it eliminates error  
> 
> There is an error checking, if tracecmd_copy_headers() returns 0 then
> the ihandle state must be valid and we can use it safely.
> The tracecmd_get_file_state() could fail only in case of a NULL
> ihandle pointer.

Nevermind, I mistaken the "tracecmd_get_file_state()" as
"tracecmd_copy_headers()", I didn't notice that you introduced another API.

Sure something like this would work too.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux