Re: [PATCH 0/2] libtraceevent: Allow %pIS to work with dynamic arrays

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

 



Chuck,

I forgot to add you to the Cc of the series, but you can download it from
here:

  https://patchwork.kernel.org/series/604304/mbox/

-- Steve


On Mon, 10 Jan 2022 19:17:03 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> Chuck Lever reported that adding the following:
> 
> #define field_sockaddr(field, len)  __dynamic_array(u8, field, len)
> #define assign_sockaddr(dest, src, len)  memcpy(__get_dynamic_array(dest), src, len)
> #define __get_sockaddr(field)  ((struct sockaddr *)__get_dynamic_array(field))
> 
> TRACE_EVENT(sockaddr_example,
>         TP_PROTO(
>                 const struct sockaddr *sap,
>                 size_t salen
>         ),  
>         TP_ARGS(sap, salen),
>         TP_STRUCT__entry(
>                 __field_sockaddr(addr, salen)
>         ),  
>         TP_fast_assign(
>                 __assign_sockaddr(addr, sap, salen);
>         ),  
>         TP_printk("addr=%pIS", __get_sockaddr(addr))
> );
> 
> Causes trace-cmd to report:
> 
>   "addr=ARG TYPE NOT FIELD BUT 7"
> 
> Which is not only unwanted, but rather unhelpful.
> 
> Fix it to allow %pIS to work with dynamic arrays, and also allow all fields to
> still work if they are typecasted.
> 
> Link: https://lore.kernel.org/all/164182978641.8391.8277203495236105391.stgit@xxxxxxxxxxxxxxxxxxxxxxx/
> 
> Steven Rostedt (2):
>   libtraceevent: Do not fail field parsing if field has typecast
>   libtraceevent: Allow ipsa arg to use dynamic arrays
> 
>  src/event-parse.c | 70 ++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 54 insertions(+), 16 deletions(-)
> 




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

  Powered by Linux