There is no API for clearing filter from event. After adding an API that applys a filter we must provide an identical API for clearing the filter. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- Documentation/libtracefs-filter.txt | 7 ++++++- include/tracefs.h | 2 ++ src/tracefs-filter.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/libtracefs-filter.txt b/Documentation/libtracefs-filter.txt index 7532c96..cdb0bcf 100644 --- a/Documentation/libtracefs-filter.txt +++ b/Documentation/libtracefs-filter.txt @@ -3,7 +3,7 @@ libtracefs(3) NAME ---- -tracefs_event_append_filter, tracefs_event_verify_filter tracefs_event_apply_filter - +tracefs_event_append_filter, tracefs_event_verify_filter tracefs_event_apply_filter tracefs_event_clear_filter - Add, verify and apply event filters SYNOPSIS @@ -17,6 +17,7 @@ int tracefs_event_append_filter(struct tep_event pass:[*]event, char pass:[**] f enum tracefs_synth_compare compare, const char pass:[*]val); int tracefs_event_verify_filter(struct tep_event pass:[*]event, const char pass:[*]filter, char pass:[**]err); int tracefs_event_apply_filter(struct tracefs_instance pass:[*]instance, struct tep_event pass:[*]event, const char pass:[*]filter); +int tracefs_event_clear_filter(struct tracefs_instance pass:[*]instance, struct tep_event pass:[*]event); -- @@ -70,6 +71,8 @@ with *free*(). *tracefs_event_apply_filter*() applies given _filter_ string on _event_ in given _instance_. +*tracefs_event_clear_filter*() clear all filters on _event_ in given _instance_. + RETURN VALUE ------------ *tracefs_event_append_filter*() returns 0 on success and -1 on error. @@ -81,6 +84,8 @@ freed with *free*(). *tracefs_event_apply_filter*() returns 0 on success and -1 on error. +*tracefs_event_clear_filter*() returns 0 on success and -1 on error. + EXAMPLE ------- [source,c] diff --git a/include/tracefs.h b/include/tracefs.h index 8ac9694..effc3e5 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -477,6 +477,8 @@ int tracefs_event_verify_filter(struct tep_event *event, const char *filter, char **err); int tracefs_event_apply_filter(struct tracefs_instance *instance, struct tep_event *event, const char *filter); +int tracefs_event_clear_filter(struct tracefs_instance *instance, + struct tep_event *event); #define TRACEFS_TIMESTAMP "common_timestamp" diff --git a/src/tracefs-filter.c b/src/tracefs-filter.c index 43683d0..6d8c66f 100644 --- a/src/tracefs-filter.c +++ b/src/tracefs-filter.c @@ -764,3 +764,17 @@ int tracefs_event_apply_filter(struct tracefs_instance *instance, "filter", filter); } +/** + * tracefs_event_clear_filter - clear the filter on event in given instance + * @instance: The instance in which the filter will be applied (NULL for toplevel). + * @event: The event to clear the filter on. + * + * Returns 0 on succes and -1 on error. + */ +int tracefs_event_clear_filter(struct tracefs_instance *instance, + struct tep_event *event) +{ + return tracefs_event_file_write(instance, event->system, event->name, + "filter", "0"); +} + -- 2.32.0