lkml.org 
[lkml]   [2022]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/13 v2] tracing/events: Add __vstring() and __assign_vstr() helper macros
On Fri, 15 Jul 2022 17:42:14 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> It uses the helper:
>
> #define __trace_event_vstr_len(fmt, va) \
> ({ \
> va_list __ap; \
> int __ret; \
> \
> va_copy(__ap, *(va)); \
> __ret = vsnprintf(NULL, 0, fmt, __ap); \
> va_end(__ap); \
> \
> min(__ret, TRACE_EVENT_STR_MAX); \
> })

I forgot to mention what is different in v2. I fixed what happened to be in
the change log, as there was an off by one error. I just updated the change
log in my git repo to have the above be:

It uses the helper:

#define __trace_event_vstr_len(fmt, va) \
({ \
va_list __ap; \
int __ret; \
\
va_copy(__ap, *(va)); \
__ret = vsnprintf(NULL, 0, fmt, __ap) + 1; \
va_end(__ap); \
\
min(__ret, TRACE_EVENT_STR_MAX); \
})


-- Steve

\
 
 \ /
  Last update: 2022-07-15 23:44    [W:0.405 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site