The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: "Jiri Olsa" <jolsa@kernel.org>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"Matt Fleming" <matt@codeblueprint.co.uk>,
	"Raphaël Beamonte" <raphael.beamonte@gmail.com>
Subject: Re: [PATCH] tools lib api fs: Store tracing mountpoint for better error message
Date: Sat, 19 Sep 2015 17:00:58 +0200	[thread overview]
Message-ID: <20150919150058.GD6650@krava.brq.redhat.com> (raw)
In-Reply-To: <55FD762B.4080607@gmail.com>

On Sat, Sep 19, 2015 at 08:50:19AM -0600, David Ahern wrote:
> On 9/19/15 8:47 AM, Jiri Olsa wrote:
> 
> >diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> >index 38aca2dd1946..0406a7d5c891 100644
> >--- a/tools/lib/api/fs/tracing_path.c
> >+++ b/tools/lib/api/fs/tracing_path.c
> >@@ -12,12 +12,14 @@
> >  #include "tracing_path.h"
> >
> >
> >+char tracing_mnt[PATH_MAX + 1]         = "/sys/kernel/debug";
> >  char tracing_path[PATH_MAX + 1]        = "/sys/kernel/debug/tracing";
> >  char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
> 
> why all the +1s? null terminator has to fit within PATH_MAX as well.

good question.. can't see a reason ATM

jirka

> 
> >
> >
> >  static void __tracing_path_set(const char *tracing, const char *mountpoint)
> >  {
> >+	snprintf(tracing_mnt, sizeof(tracing_mnt), "%s", mountpoint);
> >  	snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
> >  		 mountpoint, tracing);
> >  	snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
> >@@ -109,19 +111,10 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
> >  			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
> >  		break;
> >  	case EACCES: {
> >-		const char *mountpoint = debugfs__mountpoint();
> >-
> >-		if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
> >-			const char *tracefs_mntpoint = tracefs__mountpoint();
> >-
> >-			if (tracefs_mntpoint)
> >-				mountpoint = tracefs__mountpoint();
> >-		}
> >-
> >  		snprintf(buf, size,
> >  			 "Error:\tNo permissions to read %s/%s\n"
> >  			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
> >-			 tracing_events_path, filename, mountpoint);
> >+			 tracing_events_path, filename, tracing_mnt);
> >  	}
> >  		break;
> >  	default:
> >
> 
> LGTM.
> 
> David

  reply	other threads:[~2015-09-19 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-19 14:47 [PATCH] tools lib api fs: Store tracing mountpoint for better error message Jiri Olsa
2015-09-19 14:50 ` David Ahern
2015-09-19 15:00   ` Jiri Olsa [this message]
2015-09-19 15:23     ` Raphaël Beamonte
2015-09-19 15:26 ` Raphaël Beamonte
2015-09-29  8:38 ` [tip:perf/core] " tip-bot for Jiri Olsa

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=20150919150058.GD6650@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=raphael.beamonte@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