linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org, stefano.devenuto99@gmail.com
Subject: Re: [PATCH v33 5/5] trace-cmd [POC]: Add KVM timestamp synchronization plugin
Date: Fri, 26 Mar 2021 18:17:51 -0400	[thread overview]
Message-ID: <20210326181751.6b3233a3@gandalf.local.home> (raw)
In-Reply-To: <20210325071413.543640-6-tz.stoyanov@gmail.com>

On Thu, 25 Mar 2021 09:14:13 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> +static int read_ll_form_file(char *file, long long *res)

Is this reading a ll form file, or is this suppose to be read ll from file?

> +{
> +	char buf[32];
> +	int ret;
> +	int fd;
> +
> +	if (!file)
> +		return -1;
> +	fd = open(file, O_RDONLY | O_NONBLOCK);
> +	if (fd < 0)
> +		return -1;
> +	ret = read(fd, buf, 32);
> +	close(fd);
> +	if (ret <= 0)
> +		return -1;
> +
> +	*res = strtoll(buf, NULL, 10);

Also, if for some reason this file produced hex this wont work. Should we
just let it detect the format?

	*res = strtoll(buf, NULL, 0);

This way both "10" and "0xa" would produce the same result.

-- Steve


> +
> +	return 0;
> +}

      reply	other threads:[~2021-03-26 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  7:14 [PATCH v33 0/5] Timestamp synchronization of host - guest tracing session Tzvetomir Stoyanov (VMware)
2021-03-25  7:14 ` [PATCH v33 1/5] trace-cmd: Add dummy function to initialize timestamp sync logic Tzvetomir Stoyanov (VMware)
2021-03-25  7:14 ` [PATCH v33 2/5] trace-cmd: Add timestamp synchronization per vCPU Tzvetomir Stoyanov (VMware)
2021-03-25  7:14 ` [PATCH v33 3/5] trace-cmd: PTP-like algorithm for host - guest timestamp synchronization Tzvetomir Stoyanov (VMware)
2021-03-25  7:14 ` [PATCH v33 4/5] trace-cmd: Debug scripts for " Tzvetomir Stoyanov (VMware)
2021-03-25  7:14 ` [PATCH v33 5/5] trace-cmd [POC]: Add KVM timestamp synchronization plugin Tzvetomir Stoyanov (VMware)
2021-03-26 22:17   ` Steven Rostedt [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=20210326181751.6b3233a3@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=stefano.devenuto99@gmail.com \
    --cc=tz.stoyanov@gmail.com \
    /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).