tracing: Add a backward-compatibility check for synthetic event creation
authorTom Zanussi <zanussi@kernel.org>
Mon, 1 Feb 2021 19:48:14 +0000 (13:48 -0600)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 9 Feb 2021 17:52:15 +0000 (12:52 -0500)
commit8b5ab6bd0b293408ed8c9450831f879ce9903ea2
tree9181d0ffc9bc5333bea7a52da4584c74e4dbc8a5
parent8d3e8165232322eb32b1404f97690d05fdfd94ef
tracing: Add a backward-compatibility check for synthetic event creation

The synthetic event parsing rework now requires semicolons between
synthetic event fields.  That requirement breaks existing users who
might already have used the old synthetic event command format, so
this adds an inner loop that can parse more than one field, if
present, between semicolons.  For each field, parse_synth_field()
checks in which version that field was introduced, using
check_field_version().  The caller, __create_synth_event() can then use
that version information to determine whether or not to enforce the
requirement on the command as a whole.

In the future, if/when new features are added, the requirement will be
that any field/string containing the new feature must use semicolons,
and the check_field_version() check can then check for those and
enforce it.  Using a version number allows this scheme to be extended
if necessary.

Link: https://lkml.kernel.org/r/74fcc500d561b40ce91c5ee94818c70c6b0c9330.1612208610.git.zanussi@kernel.org
[ zanussi: added check_field_version() comment from rostedt@goodmis.org ]
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_synth.c