1 #ifndef _LINUX_RATELIMIT_H
2 #define _LINUX_RATELIMIT_H
3 #include <linux/param.h>
5 #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
6 #define DEFAULT_RATELIMIT_BURST 10
8 struct ratelimit_state {
16 #define DEFINE_RATELIMIT_STATE(name, interval, burst) \
17 struct ratelimit_state name = {interval, burst,}
19 extern int __ratelimit(struct ratelimit_state *rs);
21 static inline int ratelimit(void)
23 static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
24 DEFAULT_RATELIMIT_BURST);
25 return __ratelimit(&rs);