lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1402202148180.4468@ionos.tec.linutronix.de>
Date:	Thu, 20 Feb 2014 21:49:16 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Alexey Perevalov <a.perevalov@...sung.com>
cc:	linux-kernel@...r.kernel.org, john.stultz@...aro.org,
	anton@...msg.org, kyungmin.park@...sung.com, cw00.choi@...sung.com,
	akpm@...ux-foundation.org
Subject: Re: [PATCH v4 1/6] Replace ternary operator to macro

On Thu, 20 Feb 2014, Alexey Perevalov wrote:

The subject line lacks any information in which part of the kernel you
are doing this.

> For extensibility purpose it's better to have _switch_ type mechanism
> for representing human readable CLOCKID* and HRMODE.
> 
> Signed-off-by: Alexey Perevalov <a.perevalov@...sung.com>
> ---
>  include/trace/events/timer.h |   16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
> index 68c2c20..185b2c6 100644
> --- a/include/trace/events/timer.h
> +++ b/include/trace/events/timer.h
> @@ -8,6 +8,16 @@
>  #include <linux/hrtimer.h>
>  #include <linux/timer.h>
>  
> +#define clockid_to_string(clockid)						\
> +	__print_symbolic(clockid,						\
> +			 { CLOCK_MONOTONIC,		"CLOCK_MONOTONIC" },	\
> +			 { CLOCK_REALTIME,		"CLOCK_REALTIME" })
> +
> +#define hrmode_to_string(hrmode)						\
> +	__print_symbolic(hrmode,						\
> +			 { HRTIMER_MODE_ABS,		"HRTIMER_MODE_ABS" },	\
> +			 { HRTIMER_MODE_REL,		"HRTIMER_MODE_REL" })
> +
>  DECLARE_EVENT_CLASS(timer_class,
>  
>  	TP_PROTO(struct timer_list *timer),
> @@ -147,10 +157,8 @@ TRACE_EVENT(hrtimer_init,
>  	),
>  
>  	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
> -		  __entry->clockid == CLOCK_REALTIME ?
> -			"CLOCK_REALTIME" : "CLOCK_MONOTONIC",
> -		  __entry->mode == HRTIMER_MODE_ABS ?
> -			"HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
> +		  clockid_to_string(__entry->clockid),
> +		  hrmode_to_string(__entry->mode))
>  );
>  
>  /**
> -- 
> 1.7.9.5
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ