diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-07-16 20:55:10 -0400 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2021-08-17 11:47:52 -0400 |
commit | 883b4aee4dec64bc807a7dda4651c6a5efe9a74d (patch) | |
tree | 63f49ec8f535ab4ca9a8d31a65317b23240a2ebe /samples/hw_breakpoint | |
parent | 496d83cf0f2fa70cfe256c2499e2d3523d3868f3 (diff) | |
download | linux-883b4aee4dec64bc807a7dda4651c6a5efe9a74d.tar.bz2 |
tracing: Add trace_event helper macros __string_len() and __assign_str_len()
There's a few cases that a string that is to be recorded in a trace event,
does not have a terminating 'nul' character, and instead, the tracepoint
passes in the length of the string to record.
Add two helper macros to the trace event code that lets this work easier,
than tricks with "%.*s" logic.
__string_len() which is similar to __string() for declaration, but takes a
length argument.
__assign_str_len() which is similar to __assign_str() for assiging the
string, but it too takes a length argument.
Note, the TRACE_EVENT() macro will allocate the location on the ring
buffer to 'len + 1', that will be used to store the string into. It is a
requirement that the 'len' used for this is a most the length of the
string being recorded.
This string can still use __get_str() just like strings created with
__string() can use to retrieve the string.
Link: https://lore.kernel.org/linux-nfs/20210513105018.7539996a@gandalf.local.home/
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'samples/hw_breakpoint')
0 files changed, 0 insertions, 0 deletions