diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-12-02 19:08:30 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-12-03 10:00:27 -0500 |
commit | eabb8980a96cff42ae70cc6ab143f4003f02c874 (patch) | |
tree | 63c1ea23691abb8dddbbb860a92b72715ec3cf2c /kernel | |
parent | e12c09cf3087b5a184ffeb55ca368e8aa436a3a2 (diff) |
tracing: Allow NOT to filter AND and OR clauses
Add support to allow not "!" for and (&&) and (||). That is:
!(field1 == X && field2 == Y)
Where the value of the full clause will be notted.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_events_filter.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index e6a33db83856..ced69da0ff55 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -489,9 +489,10 @@ static int process_ops(struct filter_pred *preds, | |||
489 | if (!WARN_ON_ONCE(!pred->fn)) | 489 | if (!WARN_ON_ONCE(!pred->fn)) |
490 | match = pred->fn(pred, rec); | 490 | match = pred->fn(pred, rec); |
491 | if (!!match == type) | 491 | if (!!match == type) |
492 | return match; | 492 | break; |
493 | } | 493 | } |
494 | return match; | 494 | /* If not of not match is equal to not of not, then it is a match */ |
495 | return !!match == !op->not; | ||
495 | } | 496 | } |
496 | 497 | ||
497 | struct filter_match_preds_data { | 498 | struct filter_match_preds_data { |
@@ -740,10 +741,10 @@ static int filter_set_pred(struct event_filter *filter, | |||
740 | * then this op can be folded. | 741 | * then this op can be folded. |
741 | */ | 742 | */ |
742 | if (left->index & FILTER_PRED_FOLD && | 743 | if (left->index & FILTER_PRED_FOLD && |
743 | (left->op == dest->op || | 744 | ((left->op == dest->op && !left->not) || |
744 | left->left == FILTER_PRED_INVALID) && | 745 | left->left == FILTER_PRED_INVALID) && |
745 | right->index & FILTER_PRED_FOLD && | 746 | right->index & FILTER_PRED_FOLD && |
746 | (right->op == dest->op || | 747 | ((right->op == dest->op && !right->not) || |
747 | right->left == FILTER_PRED_INVALID)) | 748 | right->left == FILTER_PRED_INVALID)) |
748 | dest->index |= FILTER_PRED_FOLD; | 749 | dest->index |= FILTER_PRED_FOLD; |
749 | 750 | ||