From cbef4c9225ad7c250207a151a97fb12abf34b18e Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 16 Feb 2010 19:59:59 -0500 Subject: parse-events: Add pevent_event_filtered() Add filter function pevent_event_filtered() to return true if the event has a filter against it, and false otherwise. Signed-off-by: Steven Rostedt --- parse-events.h | 3 +++ parse-filter.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/parse-events.h b/parse-events.h index cc5af58..8e42947 100644 --- a/parse-events.h +++ b/parse-events.h @@ -586,6 +586,9 @@ int pevent_filter_add_filter_str(struct event_filter *filter, int pevent_filter_match(struct event_filter *filter, struct record *record); +int pevent_event_filtered(struct event_filter *filter, + int event_id); + void pevent_filter_free(struct event_filter *filter); #endif /* _PARSE_EVENTS_H */ diff --git a/parse-filter.c b/parse-filter.c index d2f5c3b..98c31dd 100644 --- a/parse-filter.c +++ b/parse-filter.c @@ -941,6 +941,27 @@ static int test_filter(struct event_format *event, } } +/** + * pevent_event_filtered - return true if event has filter + * @filter: filter struct with filter information + * @event_id: event id to test if filter exists + * + * Returns 1 if filter found for @event_id + * otherwise 0; + */ +int pevent_event_filtered(struct event_filter *filter, + int event_id) +{ + struct filter_type *filter_type; + + if (!filter->filters) + return 0; + + filter_type = find_filter_type(filter, event_id); + + return filter_type ? 1 : 0; +} + /** * pevent_filter_match - test if a record matches a filter * @filter: filter struct with filter information -- cgit v1.2.2