diff options
-rw-r--r-- | kernel/printk/printk.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 247808333ba4..a844c611b17c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1824,28 +1824,16 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c | |||
1824 | return log_store(facility, level, lflags, 0, dict, dictlen, text, text_len); | 1824 | return log_store(facility, level, lflags, 0, dict, dictlen, text, text_len); |
1825 | } | 1825 | } |
1826 | 1826 | ||
1827 | asmlinkage int vprintk_emit(int facility, int level, | 1827 | /* Must be called under logbuf_lock. */ |
1828 | const char *dict, size_t dictlen, | 1828 | int vprintk_store(int facility, int level, |
1829 | const char *fmt, va_list args) | 1829 | const char *dict, size_t dictlen, |
1830 | const char *fmt, va_list args) | ||
1830 | { | 1831 | { |
1831 | static char textbuf[LOG_LINE_MAX]; | 1832 | static char textbuf[LOG_LINE_MAX]; |
1832 | char *text = textbuf; | 1833 | char *text = textbuf; |
1833 | size_t text_len; | 1834 | size_t text_len; |
1834 | enum log_flags lflags = 0; | 1835 | enum log_flags lflags = 0; |
1835 | unsigned long flags; | ||
1836 | int printed_len; | ||
1837 | bool in_sched = false; | ||
1838 | |||
1839 | if (level == LOGLEVEL_SCHED) { | ||
1840 | level = LOGLEVEL_DEFAULT; | ||
1841 | in_sched = true; | ||
1842 | } | ||
1843 | |||
1844 | boot_delay_msec(level); | ||
1845 | printk_delay(); | ||
1846 | 1836 | ||
1847 | /* This stops the holder of console_sem just where we want him */ | ||
1848 | logbuf_lock_irqsave(flags); | ||
1849 | /* | 1837 | /* |
1850 | * The printf needs to come first; we need the syslog | 1838 | * The printf needs to come first; we need the syslog |
1851 | * prefix which might be passed-in as a parameter. | 1839 | * prefix which might be passed-in as a parameter. |
@@ -1886,8 +1874,29 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1886 | if (dict) | 1874 | if (dict) |
1887 | lflags |= LOG_PREFIX|LOG_NEWLINE; | 1875 | lflags |= LOG_PREFIX|LOG_NEWLINE; |
1888 | 1876 | ||
1889 | printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len); | 1877 | return log_output(facility, level, lflags, |
1878 | dict, dictlen, text, text_len); | ||
1879 | } | ||
1890 | 1880 | ||
1881 | asmlinkage int vprintk_emit(int facility, int level, | ||
1882 | const char *dict, size_t dictlen, | ||
1883 | const char *fmt, va_list args) | ||
1884 | { | ||
1885 | int printed_len; | ||
1886 | bool in_sched = false; | ||
1887 | unsigned long flags; | ||
1888 | |||
1889 | if (level == LOGLEVEL_SCHED) { | ||
1890 | level = LOGLEVEL_DEFAULT; | ||
1891 | in_sched = true; | ||
1892 | } | ||
1893 | |||
1894 | boot_delay_msec(level); | ||
1895 | printk_delay(); | ||
1896 | |||
1897 | /* This stops the holder of console_sem just where we want him */ | ||
1898 | logbuf_lock_irqsave(flags); | ||
1899 | printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args); | ||
1891 | logbuf_unlock_irqrestore(flags); | 1900 | logbuf_unlock_irqrestore(flags); |
1892 | 1901 | ||
1893 | /* If called from the scheduler, we can not call up(). */ | 1902 | /* If called from the scheduler, we can not call up(). */ |