]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/ratelimit.h
ethtool: add several new link modes
[thirdparty/systemd.git] / src / basic / ratelimit.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "time-util.h"
7 #include "util.h"
8
9 typedef struct RateLimit {
10 usec_t interval; /* Keep those two fields first so they can be initialized easily: */
11 unsigned burst; /* RateLimit rl = { INTERVAL, BURST }; */
12 unsigned num;
13 usec_t begin;
14 } RateLimit;
15
16 static inline void ratelimit_reset(RateLimit *rl) {
17 rl->num = rl->begin = 0;
18 }
19
20 bool ratelimit_below(RateLimit *r);