Patchwork [1/5] trace-cmd: Use TRACE_DIR envrionment variable if defined

login
register
mail settings
Submitter Yoshihiro YUNOMAE
Date Aug. 22, 2012, 8:43 a.m.
Message ID <20120822084301.17293.90649.stgit@ltc189.sdl.hitachi.co.jp>
Download mbox | patch
Permalink /patch/179262/
State New
Headers show

Comments

Yoshihiro YUNOMAE - Aug. 22, 2012, 8:43 a.m.
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Use TRACE_DIR environment variable for setting
debugfs/tracing directory if defined. This is
for controlling guest(or remote) ftrace.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
---

 trace-util.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Steven Rostedt - Aug. 22, 2012, 1:37 p.m.
On Wed, 2012-08-22 at 17:43 +0900, Yoshihiro YUNOMAE wrote:
> From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> 
> Use TRACE_DIR environment variable for setting

TRACING_DIR would be better, as we are searching for /debug/tracing and
not /debug/trace. Perhaps DEBUG_TRACING_DIR would be even better as to
be less of a generic term.

-- Steve

> debugfs/tracing directory if defined. This is
> for controlling guest(or remote) ftrace.
> 
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
> ---
> 
>  trace-util.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/trace-util.c b/trace-util.c
> index e128188..d5a3eb4 100644
> --- a/trace-util.c
> +++ b/trace-util.c
> @@ -311,6 +311,15 @@ char *tracecmd_find_tracing_dir(void)
>  	char type[100];
>  	FILE *fp;
>  	
> +	tracing_dir = getenv("TRACE_DIR");
> +	if (tracing_dir) {
> +		tracing_dir = strdup(tracing_dir);
> +		if (!tracing_dir)
> +			die("malloc");
> +		warning("Use environmental tracing directory: %s\n", tracing_dir);
> +		return tracing_dir;
> +	}
> +
>  	if ((fp = fopen("/proc/mounts","r")) == NULL) {
>  		warning("Can't open /proc/mounts for read");
>  		return NULL;
>

Patch

diff --git a/trace-util.c b/trace-util.c
index e128188..d5a3eb4 100644
--- a/trace-util.c
+++ b/trace-util.c
@@ -311,6 +311,15 @@  char *tracecmd_find_tracing_dir(void)
 	char type[100];
 	FILE *fp;
 	
+	tracing_dir = getenv("TRACE_DIR");
+	if (tracing_dir) {
+		tracing_dir = strdup(tracing_dir);
+		if (!tracing_dir)
+			die("malloc");
+		warning("Use environmental tracing directory: %s\n", tracing_dir);
+		return tracing_dir;
+	}
+
 	if ((fp = fopen("/proc/mounts","r")) == NULL) {
 		warning("Can't open /proc/mounts for read");
 		return NULL;