printk: Make it compile with !CONFIG_PRINTK
Subsystems (2)
PATCH 1/1 printk: Make it compile with !CONFIG_PRINTK
Add missing prepend_timestamp() dummy.
--- kernel/printk.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/printk.c +1 -0
@@ -1438,6 +1438,7 @@ EXPORT_SYMBOL(printk);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 size_t prepend_timestamp (unsigned long long t,char *buf) {return 0 ; }static void call_console_drivers (int level,const char *text,size_t len) {}#endif /* CONFIG_PRINTK */
Signature · 1 line
1.7.5.4
Quoted 1 line · Hiroshi DOYU
Add missing
prepend_timestamp()dummy.
That was fixed already last week:
http://git.kernel.org/?p=linux/kernel/git/gregkh/driver-core.git;a=commitdiff;h=1fce677971e29ceaa7c569741fa9c685a7b1052a
Thanks,
Kay
Quoted 5 lines · Kay Sievers
Quoted 1 line · Hiroshi DOYU
Add missing
prepend_timestamp()dummy.That was fixed already last week:
http://git.kernel.org/?p=linux/kernel/git/gregkh/driver-core.git;a=commitdiff;h=1fce677971e29ceaa7c569741fa9c685a7b1052a
Yup, but in my opinion, this particular fix shouldn't be necessary because the CONFIG_PRINTK bits should have better code separation.
None of the code that calls prepend_timestamp should actually be compiled in when !CONFIG_PRINTK.
The same is true for unnecessary uses like the existing per-cpu:
static DEFINE_PER_CPU(int, printk_pending);
static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf);
After this patchset is accepted into mainline, I'll revive the modularization and move of kernel/printk.c and associated files into -> kernel/printk/* patch I did awhile ago.
I'll follow-on to this message with the original patches just as an fyi/rfc.
cheers, Joe
PATCH 1/4 printk: Move to separate directory for easier modification
Make it easier to break up printk into bite-sized chunks.
---
kernel/Makefile | 3 ++-
kernel/printk/Makefile | 1 +
kernel/{ => printk}/printk.c | 2 --
3 files changed, 3 insertions(+), 3 deletions(-)
create mode 100644 kernel/printk/Makefile
rename kernel/{ => printk}/printk.c (99%)kernel/Makefile +2 -1
@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y = fork.o exec_domain.o panic.o printk.o \ +obj-y = fork.o exec_domain.o panic.o \ cpu.o exit.o itimer.o time.o softirq.o resource.o \ sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o \
@@ -24,6 +24,7 @@ endif obj-y += sched/ obj-y += power/ +obj-y += printk/ obj-$(CONFIG_FREEZER) += freezer.o obj-$(CONFIG_PROFILING) += profile.o
kernel/printk/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += printk.o
kernel/printk/printk.c renamed from kernel/printk.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/kernel/printk.c -* * Copyright (C) 1991, 1992 Linus Torvalds * * Modified to make sys_syslog() more flexible: added commands to
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 2/4 printk: Separate out log_buf variables and functions
In reply to Joe PerchesAdd some clarity to the printk subsystem by restructuring the code a bit.
Move the log_buf variables and functions to separate code and header files.
--- kernel/printk/Makefile | 3 +- kernel/printk/log_buf.c | 268 ++++++++++++++++++++++++++++++++++++++++++++ kernel/printk/log_buf.h | 27 +++++ kernel/printk/printk.c | 283 ++++------------------------------------------- 4 files changed, 317 insertions(+), 264 deletions(-) create mode 100644 kernel/printk/log_buf.c create mode 100644 kernel/printk/log_buf.h
kernel/printk/Makefile +2 -1
@@ -1 +1,2 @@ -obj-y += printk.o +obj-y += printk.o +obj-y += log_buf.o
kernel/printk/log_buf.c new file +268 -0
268 lines not on this page · raw message
kernel/printk/log_buf.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef PRINTK_LOG_BUF_H +#define PRINTK_LOG_BUF_H + +#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) + +extern unsigned log_start;/* next char to be read by syslog() */ +extern unsigned con_start;/* next char to be sent to consoles */ +extern unsigned log_end;/* most-recently-written-char + 1 */ +extern unsigned logged_chars;/* Number of chars produced since last +* read+clear operation +*/ + +extern raw_spinlock_t logbuf_lock; +extern wait_queue_head_t log_wait; + +extern char __log_buf[__LOG_BUF_LEN]; +extern char *log_buf; +extern int log_buf_len; + +#define LOG_BUF_MASK (log_buf_len - 1) +#define LOG_BUF (idx) (log_buf[(idx) & LOG_BUF_MASK]) + +int log_buf_do_syslog (int type,char __user *buf,int len,bool from_file); +void log_buf_emit_char (char c); +void log_buf_zap_locks (void ); + +#endif
kernel/printk/printk.c +20 -263
389 lines not on this page · raw message
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 3/4 printk: Separate out console bits to console.[ch]
In reply to Joe PerchesAdd some clarity to the printk subsystem by restructuring the code a bit.
Move the console variables and functions to separate code and header files.
--- kernel/printk/Makefile | 1 + kernel/printk/console.c | 913 +++++++++++++++++++++++++++++++++++++++++++++++ kernel/printk/console.h | 11 + kernel/printk/printk.c | 854 +------------------------------------------- 4 files changed, 936 insertions(+), 843 deletions(-) create mode 100644 kernel/printk/console.c create mode 100644 kernel/printk/console.h
kernel/printk/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-y += printk.o obj-y += log_buf.o +obj-y += console.o
kernel/printk/console.c new file +913 -0
913 lines not on this page · raw message
kernel/printk/console.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef PRINTK_CONSOLE_H +#define PRINTK_CONSOLE_H + +int console_do_syslog (int type,char __user *buf,int len,bool from_file); +void console_zap_locks (void ); +int console_trylock_for_printk(unsigned int cpu) + __releases(&logbuf_lock); +int __cpuinit console_cpu_notify (struct notifier_block *self, +unsigned long action,void *hcpu); + +#endif
kernel/printk/printk.c +11 -843
934 lines not on this page · raw message
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 4/4 printk: Separate out kmsg bits to kmsg.c
In reply to Joe PerchesAdd some clarity to the printk subsystem by restructuring the code a bit.
Move the kmsg variables and functions to a separate code file.
--- kernel/printk/Makefile | 1 + kernel/printk/kmsg.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ kernel/printk/printk.c | 107 --------------------------------------------- 3 files changed, 115 insertions(+), 107 deletions(-) create mode 100644 kernel/printk/kmsg.c
kernel/printk/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-y += printk.o obj-y += log_buf.o obj-y += console.o +obj-y += kmsg.o
kernel/printk/kmsg.c new file +114 -0
114 lines not on this page · raw message
kernel/printk/printk.c +0 -107
117 lines not on this page · raw message
Signature · 1 line
1.7.8.111.gad25c.dirty