diff options
| author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-27 12:25:57 -0300 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-27 12:25:57 -0300 |
| commit | 50cb993ea6cd187bfed085cb3e0747066edeb02f (patch) | |
| tree | 61edac62c6c5bc07c59e4369c50c6821ad77f2c0 /include/linux/ratelimit.h | |
| parent | 445c2714cf72817ab1ad3ca894c6d9b2047b3a3e (diff) | |
| parent | 8be1a6d6c77ab4532e4476fdb8177030ef48b52c (diff) | |
Merge ../linux-2.6
Diffstat (limited to 'include/linux/ratelimit.h')
| -rw-r--r-- | include/linux/ratelimit.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h new file mode 100644 index 000000000000..18a5b9ba9d40 --- /dev/null +++ b/include/linux/ratelimit.h @@ -0,0 +1,27 @@ +#ifndef _LINUX_RATELIMIT_H +#define _LINUX_RATELIMIT_H +#include <linux/param.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; +}; + +#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ + struct ratelimit_state name = {interval, burst,} + +extern int __ratelimit(struct ratelimit_state *rs); + +static inline int ratelimit(void) +{ + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + return __ratelimit(&rs); +} +#endif |
