From ddd86436f4e3643c04b797f858dab95d5f2e4de9 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Dec 2015 15:00:15 +0000 Subject: fish --- backport-include/linux/printk.h | 105 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 backport-include/linux/printk.h (limited to 'backport-include/linux/printk.h') diff --git a/backport-include/linux/printk.h b/backport-include/linux/printk.h new file mode 100644 index 0000000..6bc9931 --- /dev/null +++ b/backport-include/linux/printk.h @@ -0,0 +1,105 @@ +#ifndef _COMPAT_LINUX_PRINTK_H +#define _COMPAT_LINUX_PRINTK_H 1 + +#include + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) +#include_next +#else +#include +#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) */ + +/* see pr_fmt at end of file */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +/* backports 7a555613 */ +#if defined(CONFIG_DYNAMIC_DEBUG) +#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ + __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#else +#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */ + +#ifndef pr_warn +#define pr_warn pr_warning +#endif + +#ifndef printk_once +#define printk_once(x...) ({ \ + static bool __print_once; \ + \ + if (!__print_once) { \ + __print_once = true; \ + printk(x); \ + } \ +}) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) +#define pr_emerg_once(fmt, ...) \ + printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_alert_once(fmt, ...) \ + printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_crit_once(fmt, ...) \ + printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_err_once(fmt, ...) \ + printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warn_once(fmt, ...) \ + printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) +#define pr_notice_once(fmt, ...) \ + printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) +#define pr_info_once(fmt, ...) \ + printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +#define pr_cont_once(fmt, ...) \ + printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) +#if defined(DEBUG) +#define pr_debug_once(fmt, ...) \ + printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#else +#define pr_debug_once(fmt, ...) \ + no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#endif +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) +/* mask va_format as RHEL6 backports this */ +#define va_format LINUX_BACKPORT(va_format) + +struct va_format { + const char *fmt; + va_list *va; +}; + +/* + * Dummy printk for disabled debugging statements to use whilst maintaining + * gcc's format and side-effect checking. + */ +/* mask no_printk as RHEL6 backports this */ +#define no_printk LINUX_BACKPORT(no_printk) +static inline __attribute__ ((format (printf, 1, 2))) +int no_printk(const char *s, ...) { return 0; } +#endif + +#endif /* _COMPAT_LINUX_PRINTK_H */ + +/* This must be outside -- see also kernel.h */ +#ifndef pr_fmt +#define pr_fmt(fmt) fmt +#endif -- cgit v1.2.3