Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * internal.h - printk internal definitions
0004  */
0005 #include <linux/percpu.h>
0006 
0007 #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
0008 void __init printk_sysctl_init(void);
0009 int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
0010                   void *buffer, size_t *lenp, loff_t *ppos);
0011 #else
0012 #define printk_sysctl_init() do { } while (0)
0013 #endif
0014 
0015 #ifdef CONFIG_PRINTK
0016 
0017 /* Flags for a single printk record. */
0018 enum printk_info_flags {
0019     LOG_NEWLINE = 2,    /* text ended with a newline */
0020     LOG_CONT    = 8,    /* text is a fragment of a continuation line */
0021 };
0022 
0023 __printf(4, 0)
0024 int vprintk_store(int facility, int level,
0025           const struct dev_printk_info *dev_info,
0026           const char *fmt, va_list args);
0027 
0028 __printf(1, 0) int vprintk_default(const char *fmt, va_list args);
0029 __printf(1, 0) int vprintk_deferred(const char *fmt, va_list args);
0030 
0031 bool printk_percpu_data_ready(void);
0032 
0033 #define printk_safe_enter_irqsave(flags)    \
0034     do {                    \
0035         local_irq_save(flags);      \
0036         __printk_safe_enter();      \
0037     } while (0)
0038 
0039 #define printk_safe_exit_irqrestore(flags)  \
0040     do {                    \
0041         __printk_safe_exit();       \
0042         local_irq_restore(flags);   \
0043     } while (0)
0044 
0045 void defer_console_output(void);
0046 
0047 u16 printk_parse_prefix(const char *text, int *level,
0048             enum printk_info_flags *flags);
0049 #else
0050 
0051 /*
0052  * In !PRINTK builds we still export console_sem
0053  * semaphore and some of console functions (console_unlock()/etc.), so
0054  * printk-safe must preserve the existing local IRQ guarantees.
0055  */
0056 #define printk_safe_enter_irqsave(flags) local_irq_save(flags)
0057 #define printk_safe_exit_irqrestore(flags) local_irq_restore(flags)
0058 
0059 static inline bool printk_percpu_data_ready(void) { return false; }
0060 #endif /* CONFIG_PRINTK */