root/kernel/printk/internal.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __printf
  2. printk_safe_init
  3. printk_percpu_data_ready

   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * internal.h - printk internal definitions
   4  */
   5 #include <linux/percpu.h>
   6 
   7 #ifdef CONFIG_PRINTK
   8 
   9 #define PRINTK_SAFE_CONTEXT_MASK         0x3fffffff
  10 #define PRINTK_NMI_DIRECT_CONTEXT_MASK   0x40000000
  11 #define PRINTK_NMI_CONTEXT_MASK          0x80000000
  12 
  13 extern raw_spinlock_t logbuf_lock;
  14 
  15 __printf(5, 0)
  16 int vprintk_store(int facility, int level,
  17                   const char *dict, size_t dictlen,
  18                   const char *fmt, va_list args);
  19 
  20 __printf(1, 0) int vprintk_default(const char *fmt, va_list args);
  21 __printf(1, 0) int vprintk_deferred(const char *fmt, va_list args);
  22 __printf(1, 0) int vprintk_func(const char *fmt, va_list args);
  23 void __printk_safe_enter(void);
  24 void __printk_safe_exit(void);
  25 
  26 void printk_safe_init(void);
  27 bool printk_percpu_data_ready(void);
  28 
  29 #define printk_safe_enter_irqsave(flags)        \
  30         do {                                    \
  31                 local_irq_save(flags);          \
  32                 __printk_safe_enter();          \
  33         } while (0)
  34 
  35 #define printk_safe_exit_irqrestore(flags)      \
  36         do {                                    \
  37                 __printk_safe_exit();           \
  38                 local_irq_restore(flags);       \
  39         } while (0)
  40 
  41 #define printk_safe_enter_irq()         \
  42         do {                                    \
  43                 local_irq_disable();            \
  44                 __printk_safe_enter();          \
  45         } while (0)
  46 
  47 #define printk_safe_exit_irq()                  \
  48         do {                                    \
  49                 __printk_safe_exit();           \
  50                 local_irq_enable();             \
  51         } while (0)
  52 
  53 void defer_console_output(void);
  54 
  55 #else
  56 
  57 __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
  58 
  59 /*
  60  * In !PRINTK builds we still export logbuf_lock spin_lock, console_sem
  61  * semaphore and some of console functions (console_unlock()/etc.), so
  62  * printk-safe must preserve the existing local IRQ guarantees.
  63  */
  64 #define printk_safe_enter_irqsave(flags) local_irq_save(flags)
  65 #define printk_safe_exit_irqrestore(flags) local_irq_restore(flags)
  66 
  67 #define printk_safe_enter_irq() local_irq_disable()
  68 #define printk_safe_exit_irq() local_irq_enable()
  69 
  70 static inline void printk_safe_init(void) { }
  71 static inline bool printk_percpu_data_ready(void) { return false; }
  72 #endif /* CONFIG_PRINTK */

/* [<][>][^][v][top][bottom][index][help] */