Merge branch 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: ratelimit: Make suppressed output messages more useful printk: Remove ratelimit.h from kernel.h ratelimit: Fix/allow use in atomic contexts ratelimit: Use per ratelimit context locking
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/typecheck.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/dynamic_debug.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/bug.h>
|
||||
@@ -241,8 +240,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
||||
asmlinkage int printk(const char * fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2))) __cold;
|
||||
|
||||
extern struct ratelimit_state printk_ratelimit_state;
|
||||
extern int printk_ratelimit(void);
|
||||
extern int __printk_ratelimit(const char *func);
|
||||
#define printk_ratelimit() __printk_ratelimit(__func__)
|
||||
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
|
||||
unsigned int interval_msec);
|
||||
|
||||
|
@@ -358,6 +358,7 @@ static const struct proto_ops name##_ops = { \
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/ratelimit.h>
|
||||
extern struct ratelimit_state net_ratelimit_state;
|
||||
#endif
|
||||
|
||||
|
@@ -1,20 +1,31 @@
|
||||
#ifndef _LINUX_RATELIMIT_H
|
||||
#define _LINUX_RATELIMIT_H
|
||||
#include <linux/param.h>
|
||||
|
||||
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
|
||||
#define DEFAULT_RATELIMIT_BURST 10
|
||||
#include <linux/param.h>
|
||||
#include <linux/spinlock_types.h>
|
||||
|
||||
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
|
||||
#define DEFAULT_RATELIMIT_BURST 10
|
||||
|
||||
struct ratelimit_state {
|
||||
int interval;
|
||||
int burst;
|
||||
int printed;
|
||||
int missed;
|
||||
unsigned long begin;
|
||||
spinlock_t lock; /* protect the state */
|
||||
|
||||
int interval;
|
||||
int burst;
|
||||
int printed;
|
||||
int missed;
|
||||
unsigned long begin;
|
||||
};
|
||||
|
||||
#define DEFINE_RATELIMIT_STATE(name, interval, burst) \
|
||||
struct ratelimit_state name = {interval, burst,}
|
||||
#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \
|
||||
\
|
||||
struct ratelimit_state name = { \
|
||||
.lock = __SPIN_LOCK_UNLOCKED(name.lock), \
|
||||
.interval = interval_init, \
|
||||
.burst = burst_init, \
|
||||
}
|
||||
|
||||
extern int __ratelimit(struct ratelimit_state *rs);
|
||||
#endif
|
||||
extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
|
||||
#define __ratelimit(state) ___ratelimit(state, __func__)
|
||||
|
||||
#endif /* _LINUX_RATELIMIT_H */
|
||||
|
Reference in New Issue
Block a user