Re: [PATCH 1/3] [RFC] trace: Page size per ring buffer

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

 



On Wed, Nov 17, 2021 at 8:18 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
[ ... ]
> > +static int release_header_file(struct inode *inode, struct file *file)
> > +{
> > +     struct trace_array *tr = inode->i_private;
> > +
> > +     trace_array_put(tr);
> > +
> > +     return 0;
> > +}
> > +
>
> Why add these and not just use:
>
> tracing_open_generic_tr() and tracing_release_generic()?
>
> Where the latter would need to become global to use.
>

This is another leftover of a previous version of that implementation
- I used inode->i_private to pass the buffer and filp->private_data to
pass the pointer to the function that should be called. That way the
same show_header_page_file() can be used for both "header_page" and
"header_event" files. But for that approach I had to change the
definition of ring_buffer_print_entry_header(), to be the same as
ring_buffer_print_page_header(). It would have an additional
trace_buffer input parameter that is not used. That's why decided to
have different "show_header_.." functions and not to touch
ring_buffer_print_entry_header().

>
> >  static ssize_t
> > -show_header(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
> > +show_header_page_file(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
> >  {
> > -     int (*func)(struct trace_seq *s) = filp->private_data;
> > +     struct trace_array *tr = file_inode(filp)->i_private;
>
> Then you also do not need to use the file_inode macro, because the
> tracing_open_generic_tr() will set filp->private_data to it.
>
> -- Steve
>


-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center



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

  Powered by Linux