libtracefs: Differentiate FROM and JOIN events if they are the same event

If both the FROM and the JOIN event are the same, the fields get
confusing due to the way tracefs_sql() does not distinguish the events
when transforming the variable names, and it may process the JOIN fields
as the FROM fields, and the wrong field gets passed to the synthetic
event.

Add a new FIELD_TYPE enum and set the fields to FROM or TO to know which
event the field belongs to, and use that to avoid picking the field for
the wrong event.

Link: https://lore.kernel.org/linux-trace-devel/20220606192953.334315-4-rostedt@goodmis.org

Tested-by: Harald Seiler <hws@denx.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 file changed