From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/2] trace-cmd: Validate input parameters of tracecmd_get_guest_cpumap() API
Date: Thu, 9 Apr 2020 16:28:35 +0300 [thread overview]
Message-ID: <20200409132835.79530-3-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20200409132835.79530-1-tz.stoyanov@gmail.com>
The API:
int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
unsigned long long trace_id,
const char **name,
int *vcpu_count, const int **cpu_pid)
is used to retrieve the host PID to guest VCPU mapping from a tracecmd input
handle, if such information is available in the trace.dat file for
the peer with the given trace_id. The input parameters name, vcpu_count and
cpu_pid are mandatory, they are used to return then requested mapping.
The API could be used also to check if such information is available, without
requesting it. Made those input parameters optional, so the API can be used
in this use case.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
lib/trace-cmd/trace-input.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 6c358131..8651dac1 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3823,9 +3823,12 @@ int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
if (!guest)
return -1;
- *name = guest->name;
- *vcpu_count = guest->vcpu_count;
- *cpu_pid = guest->cpu_pid;
+ if (name)
+ *name = guest->name;
+ if (vcpu_count)
+ *vcpu_count = guest->vcpu_count;
+ if (cpu_pid)
+ *cpu_pid = guest->cpu_pid;
return 0;
}
--
2.25.1
prev parent reply other threads:[~2020-04-09 13:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 13:28 [PATCH 0/2] Useful APIs for merging tracing files Tzvetomir Stoyanov (VMware)
2020-04-09 13:28 ` [PATCH 1/2] trace-cmd: Add new API tracecmd_set_merge_peer() Tzvetomir Stoyanov (VMware)
2020-04-10 1:07 ` Steven Rostedt
2020-04-13 7:05 ` Tzvetomir Stoyanov
2020-04-09 13:28 ` Tzvetomir Stoyanov (VMware) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200409132835.79530-3-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).