The events list is currently a single linked list. New events are prepended to the list, making them the new head.
This makes it easy to fetch the last-defined event when handling trigger and filter options on the cmdline, as they apply to the last-defined event, but means the events are then processed in LIFO order with regards to the command line order. To prepare for processing the events in the user-defined order, make the events list double linked. Signed-off-by: Valentin Schneider <[email protected]> --- tools/tracing/rtla/src/cli_p.h | 4 +++- tools/tracing/rtla/src/trace.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/cli_p.h b/tools/tracing/rtla/src/cli_p.h index f2dd7c610093d..7e3a713f97c62 100644 --- a/tools/tracing/rtla/src/cli_p.h +++ b/tools/tracing/rtla/src/cli_p.h @@ -394,8 +394,10 @@ static int opt_event_cb(const struct option *opt, const char *arg, int unset) if (!tevent) fatal("Error alloc trace event"); - if (*events) + if (*events) { tevent->next = *events; + (*events)->prev = tevent; + } *events = tevent; return 0; diff --git a/tools/tracing/rtla/src/trace.h b/tools/tracing/rtla/src/trace.h index 95b911a2228b2..eacafc0c96b31 100644 --- a/tools/tracing/rtla/src/trace.h +++ b/tools/tracing/rtla/src/trace.h @@ -4,6 +4,7 @@ struct trace_events { struct trace_events *next; + struct trace_events *prev; char *system; char *event; char *filter; -- 2.55.0
