[CRIU] [PATCH 5/5] log: Introduce pr_perr macro

Andrew Vagin avagin at parallels.com
Sat Jan 12 13:31:14 EST 2013


On Sat, Jan 12, 2013 at 05:06:17PM +0400, Cyrill Gorcunov wrote:
> 
> All the pr_ helpers we use now do *not* add tailing
> new lines symbols to the format message except pr_perror.

And it is wrong. All pr_ helpers except pr_perror should be fixed;)

> 
> This brings incovenience in coding style. And in long term
> pr_perror macro should be dropped and substituted with
> pr_perr call.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/log.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

> diff --git a/include/log.h b/include/log.h
> index a7a2d2c..e0ddb9f 100644
> --- a/include/log.h
> +++ b/include/log.h
> @@ -56,7 +56,13 @@ extern void print_on_level_perr(unsigned int loglevel, const char *format, ...)
>  	print_on_level(LOG_DEBUG,						\
>  		       LOG_PREFIX fmt, ##__VA_ARGS__)
>  
> +/* Don't use it, switch to pr_perr() */
>  #define pr_perror(fmt, ...)							\
>  	pr_err(fmt ": %m\n", ##__VA_ARGS__)
>  
> +#define pr_perr(fmt, ...)							\
> +	print_on_level_perr(LOG_ERROR,						\
> +			    "Error (%s:%d): " LOG_PREFIX fmt,			\
> +			    __FILE__, __LINE__, ##__VA_ARGS__)
> +
>  #endif /* __CR_LOG_H__ */

> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> http://lists.openvz.org/mailman/listinfo/criu



More information about the CRIU mailing list