Skip to contentSkip to conversation

libtracefs: New API for clearing filters

PATCH Superseded Yordan Karadzhov (VMware) 2 participants 5 messages Nov 30, 2021 – Dec 2, 2021 Documentation

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover libtracefs: New API for clearing filters

This patch applys on tom of the 'New tracefs APIs' patch-set.

Yordan Karadzhov (VMware) (1):
libtracefs: New API for clearing filter on event

 Documentation/libtracefs-filter.txt |  7 ++++++-
 include/tracefs.h                   |  2 ++
 src/tracefs-filter.c                | 14 ++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/1 libtracefs: New API for clearing filter on event

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.

---
 Documentation/libtracefs-filter.txt |  7 ++++++-
 include/tracefs.h                   |  2 ++
 src/tracefs-filter.c                | 14 ++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
Documentation/libtracefs-filter.txt +6 -1
index 7532c96..cdb0bcf 100644
@@ -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]
include/tracefs.h +2 -0
index 8ac9694..effc3e5 100644
@@ -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"
src/tracefs-filter.c +14 -0
index 43683d0..6d8c66f 100644
@@ -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");
+}
+
Signature · 1 line
2.32.0
#2 lore raw

Re: [PATCH 1/1] libtracefs: New API for clearing filter on event

Documentation/libtracefs-filter.txt freed with *free*(). · line 88

Quoted 6 lines · On Tue, 30 Nov 2021 16:34:22 +0200 "Yordan Karadzhov (VMware)"…
Documentation/libtracefs-filter.txt +2 -0
@@ -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.
+

I just applied Tzvetomir's patches, and he renamed the function to:

tracefs_event_filter_apply()

Can you resubmit a rebased version of this patch and rename he function to:

tracefs_event_filter_clear()

Thanks,

-- Steve

#3 lore raw
In reply to Yordan Karadzhov (VMware)
Quoted 1 line · On Tue, 30 Nov 2021 16:34:21 +0200 "Yordan Karadzhov (VMware)"…

This patch applys on tom of the 'New tracefs APIs' patch-set.

Please post a link to the patches that this series applies on top of. Subject names are not precise (harder to find).

-- Steve