printk - fix compilation for CONFIG_PRINTK=n
Reported-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6a7e2618b3
commit
7f3a781d6f
2 changed files with 28 additions and 23 deletions
|
@ -825,7 +825,9 @@ static const struct memdev {
|
||||||
[7] = { "full", 0666, &full_fops, NULL },
|
[7] = { "full", 0666, &full_fops, NULL },
|
||||||
[8] = { "random", 0666, &random_fops, NULL },
|
[8] = { "random", 0666, &random_fops, NULL },
|
||||||
[9] = { "urandom", 0666, &urandom_fops, NULL },
|
[9] = { "urandom", 0666, &urandom_fops, NULL },
|
||||||
|
#ifdef CONFIG_PRINTK
|
||||||
[11] = { "kmsg", 0644, &kmsg_fops, NULL },
|
[11] = { "kmsg", 0644, &kmsg_fops, NULL },
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_CRASH_DUMP
|
#ifdef CONFIG_CRASH_DUMP
|
||||||
[12] = { "oldmem", 0, &oldmem_fops, NULL },
|
[12] = { "oldmem", 0, &oldmem_fops, NULL },
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,7 +126,6 @@ EXPORT_SYMBOL(console_set_on_cmdline);
|
||||||
/* Flag: console code may call schedule() */
|
/* Flag: console code may call schedule() */
|
||||||
static int console_may_schedule;
|
static int console_may_schedule;
|
||||||
|
|
||||||
#ifdef CONFIG_PRINTK
|
|
||||||
/*
|
/*
|
||||||
* The printk log buffer consists of a chain of concatenated variable
|
* The printk log buffer consists of a chain of concatenated variable
|
||||||
* length records. Every record starts with a record header, containing
|
* length records. Every record starts with a record header, containing
|
||||||
|
@ -208,8 +207,22 @@ struct log {
|
||||||
*/
|
*/
|
||||||
static DEFINE_RAW_SPINLOCK(logbuf_lock);
|
static DEFINE_RAW_SPINLOCK(logbuf_lock);
|
||||||
|
|
||||||
/* cpu currently holding logbuf_lock */
|
/* the next printk record to read by syslog(READ) or /proc/kmsg */
|
||||||
static volatile unsigned int logbuf_cpu = UINT_MAX;
|
static u64 syslog_seq;
|
||||||
|
static u32 syslog_idx;
|
||||||
|
|
||||||
|
/* index and sequence number of the first record stored in the buffer */
|
||||||
|
static u64 log_first_seq;
|
||||||
|
static u32 log_first_idx;
|
||||||
|
|
||||||
|
/* index and sequence number of the next record to store in the buffer */
|
||||||
|
static u64 log_next_seq;
|
||||||
|
#ifdef CONFIG_PRINTK
|
||||||
|
static u32 log_next_idx;
|
||||||
|
|
||||||
|
/* the next printk record to read after the last 'clear' command */
|
||||||
|
static u64 clear_seq;
|
||||||
|
static u32 clear_idx;
|
||||||
|
|
||||||
#define LOG_LINE_MAX 1024
|
#define LOG_LINE_MAX 1024
|
||||||
|
|
||||||
|
@ -219,21 +232,8 @@ static char __log_buf[__LOG_BUF_LEN];
|
||||||
static char *log_buf = __log_buf;
|
static char *log_buf = __log_buf;
|
||||||
static u32 log_buf_len = __LOG_BUF_LEN;
|
static u32 log_buf_len = __LOG_BUF_LEN;
|
||||||
|
|
||||||
/* index and sequence number of the first record stored in the buffer */
|
/* cpu currently holding logbuf_lock */
|
||||||
static u64 log_first_seq;
|
static volatile unsigned int logbuf_cpu = UINT_MAX;
|
||||||
static u32 log_first_idx;
|
|
||||||
|
|
||||||
/* index and sequence number of the next record to store in the buffer */
|
|
||||||
static u64 log_next_seq;
|
|
||||||
static u32 log_next_idx;
|
|
||||||
|
|
||||||
/* the next printk record to read after the last 'clear' command */
|
|
||||||
static u64 clear_seq;
|
|
||||||
static u32 clear_idx;
|
|
||||||
|
|
||||||
/* the next printk record to read by syslog(READ) or /proc/kmsg */
|
|
||||||
static u64 syslog_seq;
|
|
||||||
static u32 syslog_idx;
|
|
||||||
|
|
||||||
/* human readable text of the record */
|
/* human readable text of the record */
|
||||||
static char *log_text(const struct log *msg)
|
static char *log_text(const struct log *msg)
|
||||||
|
@ -1425,13 +1425,16 @@ asmlinkage int printk(const char *fmt, ...)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(printk);
|
EXPORT_SYMBOL(printk);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static void call_console_drivers(int level, const char *text, size_t len)
|
#define LOG_LINE_MAX 0
|
||||||
{
|
static struct log *log_from_idx(u32 idx) { return NULL; }
|
||||||
}
|
static u32 log_next(u32 idx) { return 0; }
|
||||||
|
static char *log_text(const struct log *msg) { return NULL; }
|
||||||
|
static void call_console_drivers(int level, const char *text, size_t len) {}
|
||||||
|
|
||||||
#endif
|
#endif /* CONFIG_PRINTK */
|
||||||
|
|
||||||
static int __add_preferred_console(char *name, int idx, char *options,
|
static int __add_preferred_console(char *name, int idx, char *options,
|
||||||
char *brl_options)
|
char *brl_options)
|
||||||
|
@ -1715,7 +1718,7 @@ static u32 console_idx;
|
||||||
* by printk(). If this is the case, console_unlock(); emits
|
* by printk(). If this is the case, console_unlock(); emits
|
||||||
* the output prior to releasing the lock.
|
* the output prior to releasing the lock.
|
||||||
*
|
*
|
||||||
* If there is output waiting, we wake it /dev/kmsg and syslog() users.
|
* If there is output waiting, we wake /dev/kmsg and syslog() users.
|
||||||
*
|
*
|
||||||
* console_unlock(); may be called from any context.
|
* console_unlock(); may be called from any context.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue