Skip to contentSkip to conversation

trace-cmd: Minor updates to tracecmd_unpair_peer() function

PATCH In review Steven Rostedt 2 participants 4 messages Apr 13, 2020 – Apr 14, 2020

lore
Share & tools
lore
#0 lore raw

cover trace-cmd: Minor updates to tracecmd_unpair_peer() function

Some minor clean ups of Tzvetomir's code for tracecmd_unpair_peer().

Instead of asking Tzvetomir to send another version, as these were minor changes, I just decided to do it myself ;-)

Steven Rostedt (VMware) (2):
trace-cmd: Fix cut and paste header comment of tracecmd_unpair_peer()
trace-cmd: Make tracecmd_unpair_peer() return void

----

 include/trace-cmd/trace-cmd.h |  2 +-
 lib/trace-cmd/trace-input.c   | 11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/2 trace-cmd: Fix cut and paste header comment of tracecmd_unpair_peer()

From: "Steven Rostedt (VMware)" <[email protected]>

The comment describing tracecmd_unpair_peer() is the same as the comment for tracecmd_pair_peer(). Update it to describe the unpair function.

---
 lib/trace-cmd/trace-input.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/trace-cmd/trace-input.c +2 -3
index c19aa4005767..50d52f49a8f0 100644
@@ -3233,9 +3233,8 @@ fail:
 }
 
 /**
- * tracecmd_unpair_peer - Link a tracing peer to this handle
+ * tracecmd_unpair_peer - Remove the linked tracing peer of this handle
  * @handle: input handle for the trace.dat file
- * @peer: input handle for the tracing peer
  *
  * When tracing host and one or more guest machines at the same time,
  * guest and host are tracing peers. There is information in both trace
@@ -3244,7 +3243,7 @@ fail:
  * merging the events. When the host is set as a tracing peer to the guest, then
  * the timestamps of guest's events are recalculated to match the host event's time
  *
- * Returns 1, if a peer is already paired, -1 in case of an error or 0 otherwise
+ * This removes any peer that is linked to the  @handle.
  */
 int tracecmd_unpair_peer(struct tracecmd_input *handle)
 {
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 trace-cmd: Make tracecmd_unpair_peer() return void

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

The return value of tracecmd_unpair_peer() is useless. Just make it a void function call.

---
 include/trace-cmd/trace-cmd.h | 2 +-
 lib/trace-cmd/trace-input.c   | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
include/trace-cmd/trace-cmd.h +1 -1
index 76fcffaea235..f3c95f3087a2 100644
@@ -147,7 +147,7 @@ struct tracecmd_input *tracecmd_open_head(const char *file);
 struct tracecmd_input *tracecmd_open_fd(int fd);
 int tracecmd_pair_peer(struct tracecmd_input *handle,
 		       struct tracecmd_input *peer);
-int tracecmd_unpair_peer(struct tracecmd_input *handle);
+void tracecmd_unpair_peer(struct tracecmd_input *handle);
 void tracecmd_ref(struct tracecmd_input *handle);
 void tracecmd_close(struct tracecmd_input *handle);
 int tracecmd_read_headers(struct tracecmd_input *handle);
lib/trace-cmd/trace-input.c +2 -4
index 50d52f49a8f0..55c3d80a6057 100644
@@ -3245,18 +3245,16 @@ fail:
  *
  * This removes any peer that is linked to the  @handle.
  */
-int tracecmd_unpair_peer(struct tracecmd_input *handle)
+void tracecmd_unpair_peer(struct tracecmd_input *handle)
 {
 	if (!handle)
-		return -1;
+		return;
 
 	if (handle->host.peer_data) {
 		tracecmd_close(handle->host.peer_data);
 		handle->host.peer_data = NULL;
 		tsync_check_enable(handle);
 	}
-
-	return 0;
 }
 
 /**
Signature · 1 line
2.25.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Steven Rostedt
Quoted 11 lines · Steven Rostedt

Some minor clean ups of Tzvetomir's code for tracecmd_unpair_peer().

Instead of asking Tzvetomir to send another version, as these were minor changes, I just decided to do it myself ;-)

Steven Rostedt (VMware) (2):
trace-cmd: Fix cut and paste header comment of tracecmd_unpair_peer()
trace-cmd: Make tracecmd_unpair_peer() return void

Thanks, Steven!

Quoted 4 lines

----

 include/trace-cmd/trace-cmd.h |  2 +-
 lib/trace-cmd/trace-input.c   | 11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)
Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center