All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] libtraceevent: Allow %pIS to work with dynamic arrays
@ 2022-01-11  0:17 Steven Rostedt
  2022-01-11  0:17 ` [PATCH 1/2] libtraceevent: Do not fail field parsing if field has typecast Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2022-01-11  0:17 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt

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@bazille.1015granger.net/

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(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-11  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  0:17 [PATCH 0/2] libtraceevent: Allow %pIS to work with dynamic arrays Steven Rostedt
2022-01-11  0:17 ` [PATCH 1/2] libtraceevent: Do not fail field parsing if field has typecast Steven Rostedt
2022-01-11  0:17 ` [PATCH 2/2] libtraceevent: Allow ipsa arg to use dynamic arrays Steven Rostedt
2022-01-11  0:37 ` [PATCH 0/2] libtraceevent: Allow %pIS to work with " Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.