linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* trace-cmd record: Update filter_command() to use tracefs_instance_file_append()
@ 2021-05-13 21:03 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-05-13 21:03 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Now that trace-cmd depends on libtracefs 1.2, have filter_command use the
tracefs_instance_file_append() as it had originally when first added,
instead of open coding it for libtracefs 1.1.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 5219d60b..ba9542ff 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -4556,20 +4556,7 @@ enum filter_type {
 
 static int filter_command(struct tracefs_instance *instance, const char *cmd)
 {
-	char *path;
-	int ret;
-	int fd;
-
-	path = tracefs_instance_get_file(instance, "set_ftrace_filter");
-	if (!path)
-		return -1;
-	fd = open(path, O_WRONLY);
-	tracefs_put_tracing_file(path);
-	if (fd < 0)
-		return -1;
-	ret = write(fd, cmd, strlen(cmd));
-	close(fd);
-	return ret;
+	return tracefs_instance_file_append(instance, "set_ftrace_filter", cmd);
 }
 
 static int write_func_filter(enum filter_type type, struct buffer_instance *instance,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-13 21:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 21:03 trace-cmd record: Update filter_command() to use tracefs_instance_file_append() Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).