diff mbox series

Use instance->name for guests and not tracefs instance name

Message ID 20210203172925.25cb42e2@gandalf.local.home (mailing list archive)
State Accepted
Commit 27c464a74f8f54d04814dfe25fd1b61def6092c2
Headers show
Series Use instance->name for guests and not tracefs instance name | expand

Commit Message

Steven Rostedt Feb. 3, 2021, 10:29 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Recording a guest does not use tracefs, revert part of a7f44264f
("trace-cmd: New libtracefs APIs for ftrace instances") that mistakenly
switched the guest set up from instance->name to
tracefs_instance_get_name().

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 3bcb2403..a1c4e919 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3658,11 +3658,9 @@  static void connect_to_agent(struct buffer_instance *instance)
 	unsigned int *ports;
 	int i, *fds = NULL;
 	bool use_fifos = false;
-	const char *name;
 
-	name = tracefs_instance_get_name(instance->tracefs);
 	if (!no_fifos) {
-		nr_fifos = open_guest_fifos(name, &fds);
+		nr_fifos = open_guest_fifos(instance->name, &fds);
 		use_fifos = nr_fifos > 0;
 	}
 
@@ -3703,7 +3701,7 @@  static void connect_to_agent(struct buffer_instance *instance)
 			instance->tsync.proto_name = strdup(tsync_protos_reply);
 			printf("Negotiated %s time sync protocol with guest %s\n",
 				instance->tsync.proto_name,
-				tracefs_instance_get_name(instance->tracefs));
+				instance->name);
 			tracecmd_host_tsync(instance, tsync_port);
 		} else
 			warning("Failed to negotiate timestamps synchronization with the guest");
@@ -3714,7 +3712,7 @@  static void connect_to_agent(struct buffer_instance *instance)
 		if (nr_cpus != nr_fifos) {
 			warning("number of FIFOs (%d) for guest %s differs "
 				"from number of virtual CPUs (%d)",
-				nr_fifos, name, nr_cpus);
+				nr_fifos, instance->name, nr_cpus);
 			nr_cpus = nr_cpus < nr_fifos ? nr_cpus : nr_fifos;
 		}
 		free(ports);
@@ -3747,8 +3745,7 @@  static void setup_guest(struct buffer_instance *instance)
 	int fd;
 
 	/* Create a place to store the guest meta data */
-	file = trace_get_guest_file(output_file,
-				    tracefs_instance_get_name(instance->tracefs));
+	file = trace_get_guest_file(output_file, instance->name);
 	if (!file)
 		die("Failed to allocate memory");
 
@@ -5771,6 +5768,7 @@  static void parse_record_options(int argc,
 			ctx->instance->flags |= BUFFER_FL_GUEST;
 			ctx->instance->cid = cid;
 			ctx->instance->port = port;
+			ctx->instance->name = name;
 			add_instance(ctx->instance, 0);
 			break;
 		}