[ltt-dev] [PATCH v5 4/5] Return -ERRNO instead of +ERRNO

Mathieu Desnoyers compudj at krystal.dyndns.org
Sun Nov 23 15:30:30 EST 2008


* Zhaolei (zhaolei at cn.fujitsu.com) wrote:
> Return -ERRNO is more standard in kernel.
> 
> Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>

Will merge, thanks !

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>

> ---
>  ltt/ltt-tracer.c |   26 +++++++++++++-------------
>  1 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
> index 6990c9b..b9dc694 100644
> --- a/ltt/ltt-tracer.c
> +++ b/ltt/ltt-tracer.c
> @@ -812,17 +812,17 @@ static int ltt_trace_create(const char *trace_name, const char *trace_type,
>  /* Must be called while sure that trace is in the list. */
>  static int _ltt_trace_destroy(struct ltt_trace_struct	*trace)
>  {
> -	int err = EPERM;
> +	int err = -EPERM;
>  
>  	if (trace == NULL) {
> -		err = ENOENT;
> +		err = -ENOENT;
>  		goto traces_error;
>  	}
>  	if (trace->active) {
>  		printk(KERN_ERR
>  			"LTT : Can't destroy trace %s : tracer is active\n",
>  			trace->trace_name);
> -		err = EBUSY;
> +		err = -EBUSY;
>  		goto active_error;
>  	}
>  	/* Everything went fine */
> @@ -915,7 +915,7 @@ int ltt_trace_destroy(const char *trace_name)
>  		return 0;
>  	}
>  
> -	err = ENOENT;
> +	err = -ENOENT;
>  
>  	/* Error handling */
>  error:
> @@ -930,14 +930,14 @@ static int _ltt_trace_start(struct ltt_trace_struct *trace)
>  	int err = 0;
>  
>  	if (trace == NULL) {
> -		err = ENOENT;
> +		err = -ENOENT;
>  		goto traces_error;
>  	}
>  	if (trace->active)
>  		printk(KERN_INFO "LTT : Tracing already active for trace %s\n",
>  				trace->trace_name);
>  	if (!try_module_get(ltt_run_filter_owner)) {
> -		err = ENODEV;
> +		err = -ENODEV;
>  		printk(KERN_ERR "LTT : Can't lock filter module.\n");
>  		goto get_ltt_run_filter_error;
>  	}
> @@ -977,7 +977,7 @@ int ltt_trace_start(const char *trace_name)
>  	ltt_dump_marker_state(trace);
>  
>  	if (!try_module_get(ltt_statedump_owner)) {
> -		err = ENODEV;
> +		err = -ENODEV;
>  		printk(KERN_ERR
>  			"LTT : Can't lock state dump module.\n");
>  	} else {
> @@ -997,10 +997,10 @@ EXPORT_SYMBOL_GPL(ltt_trace_start);
>  /* must be called from within traces lock */
>  static int _ltt_trace_stop(struct ltt_trace_struct *trace)
>  {
> -	int err = EPERM;
> +	int err = -EPERM;
>  
>  	if (trace == NULL) {
> -		err = ENOENT;
> +		err = -ENOENT;
>  		goto traces_error;
>  	}
>  	if (!trace->active)
> @@ -1043,7 +1043,7 @@ EXPORT_SYMBOL_GPL(ltt_trace_stop);
>  int ltt_control(enum ltt_control_msg msg, const char *trace_name,
>  		const char *trace_type, union ltt_control_args args)
>  {
> -	int err = EPERM;
> +	int err = -EPERM;
>  
>  	printk(KERN_ALERT "ltt_control : trace %s\n", trace_name);
>  	switch (msg) {
> @@ -1091,11 +1091,11 @@ int ltt_filter_control(enum ltt_filter_control_msg msg, const char *trace_name)
>  	if (trace == NULL) {
>  		printk(KERN_ALERT
>  			"Trace does not exist. Cannot proxy control request\n");
> -		err = ENOENT;
> +		err = -ENOENT;
>  		goto trace_error;
>  	}
>  	if (!try_module_get(ltt_filter_control_owner)) {
> -		err = ENODEV;
> +		err = -ENODEV;
>  		goto get_module_error;
>  	}
>  	switch (msg) {
> @@ -1110,7 +1110,7 @@ int ltt_filter_control(enum ltt_filter_control_msg msg, const char *trace_name)
>  		err = (*ltt_filter_control_functor)(msg, trace);
>  		break;
>  	default:
> -		err = EPERM;
> +		err = -EPERM;
>  	}
>  	module_put(ltt_filter_control_owner);
>  
> -- 
> 1.5.5.3
> 
> 
> 
> _______________________________________________
> 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




More information about the lttng-dev mailing list