Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198289
b: refs/heads/master
c: f40c396
h: refs/heads/master
i:
  198287: 95f08af
v: v3
  • Loading branch information
OGAWA Hirofumi authored and Linus Torvalds committed May 25, 2010
1 parent 9239ae4 commit c6b7fa3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d8521fcc5e0ad3e79bbc4231bb20a6cdc2b50164
refs/heads/master: f40c396a9ab04eae526990e2b2cef875b424ed4e
13 changes: 12 additions & 1 deletion trunk/include/linux/ratelimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _LINUX_RATELIMIT_H

#include <linux/param.h>
#include <linux/spinlock_types.h>
#include <linux/spinlock.h>

#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
#define DEFAULT_RATELIMIT_BURST 10
Expand All @@ -25,6 +25,17 @@ struct ratelimit_state {
.burst = burst_init, \
}

static inline void ratelimit_state_init(struct ratelimit_state *rs,
int interval, int burst)
{
spin_lock_init(&rs->lock);
rs->interval = interval;
rs->burst = burst;
rs->printed = 0;
rs->missed = 0;
rs->begin = 0;
}

extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define __ratelimit(state) ___ratelimit(state, __func__)

Expand Down

0 comments on commit c6b7fa3

Please sign in to comment.