diff mbox series

trace-cmd record: Update filter_command() to use tracefs_instance_file_append()

Message ID 20210513170322.5aa779d7@gandalf.local.home (mailing list archive)
State Accepted
Commit 5b88b21d2ef9295922297a291bbed0c6de1f7fff
Headers show
Series trace-cmd record: Update filter_command() to use tracefs_instance_file_append() | expand

Commit Message

Steven Rostedt May 13, 2021, 9:03 p.m. UTC
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 mbox series

Patch

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,