diff options
| author | Joe Perches <joe@perches.com> | 2014-12-10 18:50:15 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:11 -0500 |
| commit | a39d4a857d4bb0a62d6655c0d69f7387fe1ad160 (patch) | |
| tree | a10a09dd5750a654992d9cd72e940a7c8d0f707a /kernel | |
| parent | f80e696854c95725cf7faf9776e02f00600780d3 (diff) | |
printk: add and use LOGLEVEL_<level> defines for KERN_<LEVEL> equivalents
Use #defines instead of magic values.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/printk/printk.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 4815c98ae175..1b7092dbb590 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -62,9 +62,6 @@ int console_printk[4] = { | |||
| 62 | CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */ | 62 | CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */ |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | /* Deferred messaged from sched code are marked by this special level */ | ||
| 66 | #define SCHED_MESSAGE_LOGLEVEL -2 | ||
| 67 | |||
| 68 | /* | 65 | /* |
| 69 | * Low level drivers may need that to know if they can schedule in | 66 | * Low level drivers may need that to know if they can schedule in |
| 70 | * their unblank() callback or not. So let's export it. | 67 | * their unblank() callback or not. So let's export it. |
| @@ -1259,7 +1256,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1259 | int do_syslog(int type, char __user *buf, int len, bool from_file) | 1256 | int do_syslog(int type, char __user *buf, int len, bool from_file) |
| 1260 | { | 1257 | { |
| 1261 | bool clear = false; | 1258 | bool clear = false; |
| 1262 | static int saved_console_loglevel = -1; | 1259 | static int saved_console_loglevel = LOGLEVEL_DEFAULT; |
| 1263 | int error; | 1260 | int error; |
| 1264 | 1261 | ||
| 1265 | error = check_syslog_permissions(type, from_file); | 1262 | error = check_syslog_permissions(type, from_file); |
| @@ -1316,15 +1313,15 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
| 1316 | break; | 1313 | break; |
| 1317 | /* Disable logging to console */ | 1314 | /* Disable logging to console */ |
| 1318 | case SYSLOG_ACTION_CONSOLE_OFF: | 1315 | case SYSLOG_ACTION_CONSOLE_OFF: |
| 1319 | if (saved_console_loglevel == -1) | 1316 | if (saved_console_loglevel == LOGLEVEL_DEFAULT) |
| 1320 | saved_console_loglevel = console_loglevel; | 1317 | saved_console_loglevel = console_loglevel; |
| 1321 | console_loglevel = minimum_console_loglevel; | 1318 | console_loglevel = minimum_console_loglevel; |
| 1322 | break; | 1319 | break; |
| 1323 | /* Enable logging to console */ | 1320 | /* Enable logging to console */ |
| 1324 | case SYSLOG_ACTION_CONSOLE_ON: | 1321 | case SYSLOG_ACTION_CONSOLE_ON: |
| 1325 | if (saved_console_loglevel != -1) { | 1322 | if (saved_console_loglevel != LOGLEVEL_DEFAULT) { |
| 1326 | console_loglevel = saved_console_loglevel; | 1323 | console_loglevel = saved_console_loglevel; |
| 1327 | saved_console_loglevel = -1; | 1324 | saved_console_loglevel = LOGLEVEL_DEFAULT; |
| 1328 | } | 1325 | } |
| 1329 | break; | 1326 | break; |
| 1330 | /* Set level of messages printed to console */ | 1327 | /* Set level of messages printed to console */ |
| @@ -1336,7 +1333,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
| 1336 | len = minimum_console_loglevel; | 1333 | len = minimum_console_loglevel; |
| 1337 | console_loglevel = len; | 1334 | console_loglevel = len; |
| 1338 | /* Implicitly re-enable logging to console */ | 1335 | /* Implicitly re-enable logging to console */ |
| 1339 | saved_console_loglevel = -1; | 1336 | saved_console_loglevel = LOGLEVEL_DEFAULT; |
| 1340 | error = 0; | 1337 | error = 0; |
| 1341 | break; | 1338 | break; |
| 1342 | /* Number of chars in the log buffer */ | 1339 | /* Number of chars in the log buffer */ |
| @@ -1629,8 +1626,8 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1629 | /* cpu currently holding logbuf_lock in this function */ | 1626 | /* cpu currently holding logbuf_lock in this function */ |
| 1630 | static volatile unsigned int logbuf_cpu = UINT_MAX; | 1627 | static volatile unsigned int logbuf_cpu = UINT_MAX; |
| 1631 | 1628 | ||
| 1632 | if (level == SCHED_MESSAGE_LOGLEVEL) { | 1629 | if (level == LOGLEVEL_SCHED) { |
| 1633 | level = -1; | 1630 | level = LOGLEVEL_DEFAULT; |
| 1634 | in_sched = true; | 1631 | in_sched = true; |
| 1635 | } | 1632 | } |
| 1636 | 1633 | ||
| @@ -1695,8 +1692,9 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1695 | const char *end_of_header = printk_skip_level(text); | 1692 | const char *end_of_header = printk_skip_level(text); |
| 1696 | switch (kern_level) { | 1693 | switch (kern_level) { |
| 1697 | case '0' ... '7': | 1694 | case '0' ... '7': |
| 1698 | if (level == -1) | 1695 | if (level == LOGLEVEL_DEFAULT) |
| 1699 | level = kern_level - '0'; | 1696 | level = kern_level - '0'; |
| 1697 | /* fallthrough */ | ||
| 1700 | case 'd': /* KERN_DEFAULT */ | 1698 | case 'd': /* KERN_DEFAULT */ |
| 1701 | lflags |= LOG_PREFIX; | 1699 | lflags |= LOG_PREFIX; |
| 1702 | } | 1700 | } |
| @@ -1710,7 +1708,7 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1710 | } | 1708 | } |
| 1711 | } | 1709 | } |
| 1712 | 1710 | ||
| 1713 | if (level == -1) | 1711 | if (level == LOGLEVEL_DEFAULT) |
| 1714 | level = default_message_loglevel; | 1712 | level = default_message_loglevel; |
| 1715 | 1713 | ||
| 1716 | if (dict) | 1714 | if (dict) |
| @@ -1788,7 +1786,7 @@ EXPORT_SYMBOL(vprintk_emit); | |||
| 1788 | 1786 | ||
| 1789 | asmlinkage int vprintk(const char *fmt, va_list args) | 1787 | asmlinkage int vprintk(const char *fmt, va_list args) |
| 1790 | { | 1788 | { |
| 1791 | return vprintk_emit(0, -1, NULL, 0, fmt, args); | 1789 | return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); |
| 1792 | } | 1790 | } |
| 1793 | EXPORT_SYMBOL(vprintk); | 1791 | EXPORT_SYMBOL(vprintk); |
| 1794 | 1792 | ||
| @@ -1842,7 +1840,7 @@ asmlinkage __visible int printk(const char *fmt, ...) | |||
| 1842 | } | 1840 | } |
| 1843 | #endif | 1841 | #endif |
| 1844 | va_start(args, fmt); | 1842 | va_start(args, fmt); |
| 1845 | r = vprintk_emit(0, -1, NULL, 0, fmt, args); | 1843 | r = vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); |
| 1846 | va_end(args); | 1844 | va_end(args); |
| 1847 | 1845 | ||
| 1848 | return r; | 1846 | return r; |
| @@ -2631,7 +2629,7 @@ int printk_deferred(const char *fmt, ...) | |||
| 2631 | 2629 | ||
| 2632 | preempt_disable(); | 2630 | preempt_disable(); |
| 2633 | va_start(args, fmt); | 2631 | va_start(args, fmt); |
| 2634 | r = vprintk_emit(0, SCHED_MESSAGE_LOGLEVEL, NULL, 0, fmt, args); | 2632 | r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args); |
| 2635 | va_end(args); | 2633 | va_end(args); |
| 2636 | 2634 | ||
| 2637 | __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); | 2635 | __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); |
