diff options
author | Joe Perches <joe@perches.com> | 2008-02-08 07:21:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:39 -0500 |
commit | 7ef3d2fd17c377ef64a2aa19677d17576606c3b4 (patch) | |
tree | 036c2fe4a87bda412908bc82602ce29f4d431dbe | |
parent | 36e789144267105e0b3f2b9bca7db3184fce50dc (diff) |
printk_ratelimit() functions should use CONFIG_PRINTK
Makes an embedded image a bit smaller.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/kernel.h | 18 | ||||
-rw-r--r-- | kernel/printk.c | 2 | ||||
-rw-r--r-- | kernel/sysctl.c | 20 |
3 files changed, 25 insertions, 15 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7d7519628dfa..8f28d35867f8 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -180,6 +180,13 @@ asmlinkage int printk(const char * fmt, ...) | |||
180 | extern int log_buf_get_len(void); | 180 | extern int log_buf_get_len(void); |
181 | extern int log_buf_read(int idx); | 181 | extern int log_buf_read(int idx); |
182 | extern int log_buf_copy(char *dest, int idx, int len); | 182 | extern int log_buf_copy(char *dest, int idx, int len); |
183 | |||
184 | extern int printk_ratelimit_jiffies; | ||
185 | extern int printk_ratelimit_burst; | ||
186 | extern int printk_ratelimit(void); | ||
187 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
188 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | ||
189 | unsigned int interval_msec); | ||
183 | #else | 190 | #else |
184 | static inline int vprintk(const char *s, va_list args) | 191 | static inline int vprintk(const char *s, va_list args) |
185 | __attribute__ ((format (printf, 1, 0))); | 192 | __attribute__ ((format (printf, 1, 0))); |
@@ -190,6 +197,12 @@ static inline int __cold printk(const char *s, ...) { return 0; } | |||
190 | static inline int log_buf_get_len(void) { return 0; } | 197 | static inline int log_buf_get_len(void) { return 0; } |
191 | static inline int log_buf_read(int idx) { return 0; } | 198 | static inline int log_buf_read(int idx) { return 0; } |
192 | static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } | 199 | static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } |
200 | static inline int printk_ratelimit(void) { return 0; } | ||
201 | static inline int __printk_ratelimit(int ratelimit_jiffies, \ | ||
202 | int ratelimit_burst) { return 0; } | ||
203 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | ||
204 | unsigned int interval_msec) \ | ||
205 | { return false; } | ||
193 | #endif | 206 | #endif |
194 | 207 | ||
195 | extern void __attribute__((format(printf, 1, 2))) | 208 | extern void __attribute__((format(printf, 1, 2))) |
@@ -197,11 +210,6 @@ extern void __attribute__((format(printf, 1, 2))) | |||
197 | 210 | ||
198 | unsigned long int_sqrt(unsigned long); | 211 | unsigned long int_sqrt(unsigned long); |
199 | 212 | ||
200 | extern int printk_ratelimit(void); | ||
201 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
202 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | ||
203 | unsigned int interval_msec); | ||
204 | |||
205 | static inline void console_silent(void) | 213 | static inline void console_silent(void) |
206 | { | 214 | { |
207 | console_loglevel = 0; | 215 | console_loglevel = 0; |
diff --git a/kernel/printk.c b/kernel/printk.c index e95e7c6e7b04..bee36100f110 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1251,6 +1251,7 @@ void tty_write_message(struct tty_struct *tty, char *msg) | |||
1251 | return; | 1251 | return; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | #if defined CONFIG_PRINTK | ||
1254 | /* | 1255 | /* |
1255 | * printk rate limiting, lifted from the networking subsystem. | 1256 | * printk rate limiting, lifted from the networking subsystem. |
1256 | * | 1257 | * |
@@ -1320,3 +1321,4 @@ bool printk_timed_ratelimit(unsigned long *caller_jiffies, | |||
1320 | return false; | 1321 | return false; |
1321 | } | 1322 | } |
1322 | EXPORT_SYMBOL(printk_timed_ratelimit); | 1323 | EXPORT_SYMBOL(printk_timed_ratelimit); |
1324 | #endif | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index a14fd29a7a92..d41ef6b4cf72 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -73,8 +73,6 @@ extern int suid_dumpable; | |||
73 | extern char core_pattern[]; | 73 | extern char core_pattern[]; |
74 | extern int pid_max; | 74 | extern int pid_max; |
75 | extern int min_free_kbytes; | 75 | extern int min_free_kbytes; |
76 | extern int printk_ratelimit_jiffies; | ||
77 | extern int printk_ratelimit_burst; | ||
78 | extern int pid_max_min, pid_max_max; | 76 | extern int pid_max_min, pid_max_max; |
79 | extern int sysctl_drop_caches; | 77 | extern int sysctl_drop_caches; |
80 | extern int percpu_pagelist_fraction; | 78 | extern int percpu_pagelist_fraction; |
@@ -490,14 +488,6 @@ static struct ctl_table kern_table[] = { | |||
490 | .mode = 0644, | 488 | .mode = 0644, |
491 | .proc_handler = &proc_dointvec, | 489 | .proc_handler = &proc_dointvec, |
492 | }, | 490 | }, |
493 | { | ||
494 | .ctl_name = KERN_PRINTK, | ||
495 | .procname = "printk", | ||
496 | .data = &console_loglevel, | ||
497 | .maxlen = 4*sizeof(int), | ||
498 | .mode = 0644, | ||
499 | .proc_handler = &proc_dointvec, | ||
500 | }, | ||
501 | #ifdef CONFIG_KMOD | 491 | #ifdef CONFIG_KMOD |
502 | { | 492 | { |
503 | .ctl_name = KERN_MODPROBE, | 493 | .ctl_name = KERN_MODPROBE, |
@@ -644,6 +634,15 @@ static struct ctl_table kern_table[] = { | |||
644 | .mode = 0644, | 634 | .mode = 0644, |
645 | .proc_handler = &proc_dointvec, | 635 | .proc_handler = &proc_dointvec, |
646 | }, | 636 | }, |
637 | #if defined CONFIG_PRINTK | ||
638 | { | ||
639 | .ctl_name = KERN_PRINTK, | ||
640 | .procname = "printk", | ||
641 | .data = &console_loglevel, | ||
642 | .maxlen = 4*sizeof(int), | ||
643 | .mode = 0644, | ||
644 | .proc_handler = &proc_dointvec, | ||
645 | }, | ||
647 | { | 646 | { |
648 | .ctl_name = KERN_PRINTK_RATELIMIT, | 647 | .ctl_name = KERN_PRINTK_RATELIMIT, |
649 | .procname = "printk_ratelimit", | 648 | .procname = "printk_ratelimit", |
@@ -661,6 +660,7 @@ static struct ctl_table kern_table[] = { | |||
661 | .mode = 0644, | 660 | .mode = 0644, |
662 | .proc_handler = &proc_dointvec, | 661 | .proc_handler = &proc_dointvec, |
663 | }, | 662 | }, |
663 | #endif | ||
664 | { | 664 | { |
665 | .ctl_name = KERN_NGROUPS_MAX, | 665 | .ctl_name = KERN_NGROUPS_MAX, |
666 | .procname = "ngroups_max", | 666 | .procname = "ngroups_max", |