Merge tag 'v3.10.89' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / xlog.h
1 #if !defined(_LINUX_XLOG_H)
2 #define _LINUX_XLOG_H
3
4 #include <linux/linkage.h>
5
6 enum android_log_priority {
7 ANDROID_LOG_UNKNOWN = 0,
8 ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
9 ANDROID_LOG_VERBOSE,
10 ANDROID_LOG_DEBUG,
11 ANDROID_LOG_INFO,
12 ANDROID_LOG_WARN,
13 ANDROID_LOG_ERROR,
14 ANDROID_LOG_FATAL,
15 ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
16 };
17
18 #define LOGGER_ALE_ARGS_MAX 16
19
20 struct ale_convert {
21 const char *tag_str;
22 const char *fmt_ptr;
23 const char *filename;
24 int lineno;
25
26 unsigned int hash;
27 char params[LOGGER_ALE_ARGS_MAX];
28 };
29
30 struct xlog_record {
31 const char *tag_str;
32 const char *fmt_str;
33 int prio;
34 };
35
36 #if defined(HAVE_ALE_FEATURE)
37
38 int __xlog_ale_printk(int prio, const struct ale_convert *convert, ...);
39
40 #define xlog_printk(prio, tag, fmt, ...) \
41 ({ \
42 static const struct ale_convert ____xlogk_ale_rec____ = \
43 { tag, fmt, __FILE__, prio, 0, "" }; \
44 __xlog_ale_printk(prio, &____xlogk_ale_rec____, \
45 ##__VA_ARGS__); \
46 })
47
48 #else /* HAVE_ALE_FEATURE */
49
50 asmlinkage int __xlog_printk(const struct xlog_record *rec, ...);
51
52 int __xlog_ksystem_printk(const struct xlog_record *rec, ...);
53 #ifdef CONFIG_HAVE_XLOG_FEATURE
54 #define xlog_printk(prio, tag, fmt, ...) \
55 ({ \
56 static const struct xlog_record _xlog_rec = \
57 {tag, fmt, prio}; \
58 __xlog_printk(&_xlog_rec, ##__VA_ARGS__); \
59 })
60 #define xlog_ksystem_printk(prio, tag, fmt, ...) \
61 ({ \
62 static const struct xlog_record _xlog_rec = \
63 {tag, fmt, prio}; \
64 __xlog_ksystem_printk(&_xlog_rec, ##__VA_ARGS__); \
65 })
66 #else /* CONFIG_HAVE_XLOG_FEATURE */
67 #define xlog_printk(prio, tag, fmt, ...) ((void)0)
68 #define xlog_ksystem_printk(prio, tag, fmt, ...) ((void)0)
69 #endif /* CONFIG_HAVE_XLOG_FEATURE */
70 #endif /* HAVE_ALE_FEATURE */
71
72 #endif