Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH 2/2] Make lttctl load ltt-trace-control	module automatically
Date: Wed, 14 Jan 2009 20:20:18 -0500	[thread overview]
Message-ID: <20090115012018.GB7458@Krystal> (raw)
In-Reply-To: <49646327.2020307@cn.fujitsu.com>

* Zhaolei (zhaolei at cn.fujitsu.com) wrote:
> lttctl need to use ltt-trace-control module.
> This patch make lttctl try to load ltt-trace-control module automatically when
> ltt-trace-control is compiled as a module and not loaded.
> 
> Applies on ltt-control-0.63-03012009 with previous patch of:
> [PATCH 1/2] Make lttctl mount debugfs automatically
> 

Applied to ltt-control 0.64, thanks !

Mathieu

> Signed-off-by: Zhao lei <zhaolei at cn.fujitsu.com>
> ---
>  liblttctl.c |   51 +++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 39 insertions(+), 12 deletions(-)
> diff -Nur ltt-control-0.63-03012009.org/liblttctl/liblttctl.c ltt-control-0.63-03012009.new/liblttctl/liblttctl.c
> --- ltt-control-0.63-03012009.org/liblttctl/liblttctl.c	2009-01-07 15:54:45.000000000 +0800
> +++ ltt-control-0.63-03012009.new/liblttctl/liblttctl.c	2009-01-07 15:54:49.000000000 +0800
> @@ -42,11 +42,44 @@
>  	return getdebugfsmntdir(debugfsmntdir);
>  }
>  
> +/*
> + * This function must called posterior to initdebugfsmntdir(),
> + * because it need to use debugfsmntdir[] which is inited in initdebugfsmntdir()
> + */
> +static int initmodule(void)
> +{
> +	char controldirname[PATH_MAX];
> +	DIR *dir;
> +	int tryload_done = 0;
> +
> +	sprintf(controldirname, "%s/ltt/control/", debugfsmntdir);
> +
> +check_again:
> +	/*
> +	 * Check ltt control's debugfs dir
> +	 *
> +	 * We don't check is ltt-trace-control module exist, because it maybe
> +	 * compiled into kernel.
> +	 */
> +	dir = opendir(controldirname);
> +	if (dir) {
> +		closedir(dir);
> +		return 0;
> +	}
> +
> +	if (!tryload_done) {
> +		system("modprobe ltt-trace-control");
> +		tryload_done = 1;
> +		goto check_again;
> +	}
> +
> +	return -ENOENT;
> +}
> +
>  int lttctl_init(void)
>  {
>  	int ret;
> -	DIR *dir;
> -	char controldirname[PATH_MAX];
> +
>  
>  	ret = initdebugfsmntdir();
>  	if (ret) {
> @@ -54,18 +87,12 @@
>  		return 1;
>  	}
>  
> -	/* check ltt control's debugfs dir */
> -	sprintf(controldirname, "%s/ltt/control/", debugfsmntdir);
> -
> -	dir = opendir(controldirname);
> -	if (!dir) {
> -		fprintf(stderr, "ltt-trace-control's debugfs dir not found\n");
> -		closedir(dir);
> -		return -errno;
> +	ret = initmodule();
> +	if (ret) {
> +		fprintf(stderr, "Control module seems not work\n");
> +		return 1;
>  	}
>  
> -	closedir(dir);
> -
>  	return 0;
>  }
>  
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




  reply	other threads:[~2009-01-15  1:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07  8:04 [ltt-dev] [PATCH 1/2] Make lttctl mount debugfs automatically Zhaolei
2009-01-07  8:09 ` [ltt-dev] [PATCH 2/2] Make lttctl load ltt-trace-control module automatically Zhaolei
2009-01-15  1:20   ` Mathieu Desnoyers [this message]
2009-01-07 14:20 ` [ltt-dev] [PATCH 1/2] Make lttctl mount debugfs automatically Pierre-Marc Fournier
2009-01-08  0:40   ` Zhaolei
2009-01-08 14:44     ` Mathieu Desnoyers
2009-01-09  1:57       ` Zhaolei
2009-01-09  3:30         ` Mathieu Desnoyers
2009-01-13 23:54           ` Greg KH
2009-01-14  2:02             ` Josh Boyer
2009-01-14  5:16             ` Mathieu Desnoyers
2009-01-14  5:54               ` Greg KH
2009-01-15  1:41                 ` Mathieu Desnoyers
2009-01-15  1:20 ` Mathieu Desnoyers

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=20090115012018.GB7458@Krystal \
    --to=compudj@krystal.dyndns.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