From 86816401fa9183abc7b975cc0e5b5bda49974ee9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 27 Mar 2016 17:09:46 +0000 Subject: [PATCH] scst: Move more backports from scst_debug.h into backport.h git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6852 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 36 +++++++++++++++++++++++++++-- scst/include/scst_debug.h | 48 +-------------------------------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 4b5dcbc81..6c735b86c 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -375,12 +375,44 @@ static inline long get_user_pages_backport(unsigned long start, /* */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) && !defined(RHEL_MAJOR) +#define KERN_CONT "" +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) -#ifndef pr_err -#define pr_err(fmt, ...) printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +/* + * See also the following commits: + * d091c2f5 - Introduction of pr_info() etc. in . + * 311d0761 - Introduction of pr_cont() in . + * 968ab183 - Moved pr_info() etc. from to + */ +#ifndef pr_emerg + +#ifndef pr_fmt +#define pr_fmt(fmt) fmt #endif + +#define pr_emerg(fmt, ...) printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_alert(fmt, ...) printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_crit(fmt, ...) printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_err(fmt, ...) printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warning(fmt, ...) printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) +#define pr_notice(fmt, ...) printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) + +#endif /* pr_emerg */ + +#ifndef pr_info +#define pr_info(fmt, ...) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) #endif +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) +#ifndef pr_cont +#define pr_cont(fmt, ...) printk(KERN_CONT fmt, ##__VA_ARGS__) +#endif +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) /* * See also patch "kernel.h: add pr_warn for symmetry to dev_warn, diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 00ea2c559..e154c23d0 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -35,43 +35,6 @@ #include #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) -/* - * See also the following commits: - * d091c2f5 - Introduction of pr_info() etc. in . - * 311d0761 - Introduction of pr_cont() in . - * 968ab183 - Moved pr_info() etc. from to - */ -#ifndef pr_emerg -#ifndef pr_fmt -#define pr_fmt(fmt) fmt -#endif - -#define pr_emerg(fmt, ...) \ - printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) -#define pr_alert(fmt, ...) \ - printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_crit(fmt, ...) \ - printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_err(fmt, ...) \ - printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#define pr_warning(fmt, ...) \ - printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) -#define pr_notice(fmt, ...) \ - printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) -#endif -#ifndef pr_info -#define pr_info(fmt, ...) \ - printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) -#endif -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) -#ifndef pr_cont -#define pr_cont(fmt, ...) \ - printk(KERN_CONT fmt, ##__VA_ARGS__) -#endif -#endif - #if !defined(INSIDE_KERNEL_TREE) #ifdef CONFIG_SCST_DEBUG @@ -148,10 +111,6 @@ #define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR|TRACE_MGMT_DEBUG) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) && !defined(RHEL_MAJOR) -#define KERN_CONT "" -#endif - /* * Note: in the next two printk() statements the KERN_CONT macro is only * present to suppress a checkpatch warning (KERN_CONT is defined as ""). @@ -175,12 +134,7 @@ #define ___unlikely(a) unlikely(a) #endif -int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21) || defined(__printf) -__printf(6, 7) -#else -__attribute__((format(printf, 6, 7))) -#endif +int __printf(6, 7) debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, const char *func, int line, const char *fmt, ...);