diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-25 17:13:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 17:25:23 +0100 |
commit | 7491cd4c22601eb0c3bedfea740f2aec3b8372ed (patch) | |
tree | e5b8c3adf9e17e9abf3c028ea163ee7840659826 /src/ratelimiter.c | |
parent | peer: store total number of peers instead of iterating (diff) | |
download | wireguard-monolithic-historical-7491cd4c22601eb0c3bedfea740f2aec3b8372ed.tar.xz wireguard-monolithic-historical-7491cd4c22601eb0c3bedfea740f2aec3b8372ed.zip |
global: infuriating kernel iterator style
One types:
for (i = 0 ...
So one should also type:
for_each_obj (obj ...
But the upstream kernel style guidelines are insane, and so we must
instead do:
for_each_obj(obj ...
Ugly, but one must choose his battles wisely.
Diffstat (limited to 'src/ratelimiter.c')
-rw-r--r-- | src/ratelimiter.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ratelimiter.c b/src/ratelimiter.c index 0afcdac..a9caf32 100644 --- a/src/ratelimiter.c +++ b/src/ratelimiter.c @@ -57,12 +57,12 @@ static void gc_entries(struct work_struct *work) for (i = 0; i < table_size; ++i) { spin_lock(&table_lock); - hlist_for_each_entry_safe (entry, temp, &table_v4[i], hash) { + hlist_for_each_entry_safe(entry, temp, &table_v4[i], hash) { if (unlikely(!work) || now - entry->last_time_ns > NSEC_PER_SEC) entry_uninit(entry); } #if IS_ENABLED(CONFIG_IPV6) - hlist_for_each_entry_safe (entry, temp, &table_v6[i], hash) { + hlist_for_each_entry_safe(entry, temp, &table_v6[i], hash) { if (unlikely(!work) || now - entry->last_time_ns > NSEC_PER_SEC) entry_uninit(entry); } @@ -94,7 +94,7 @@ bool ratelimiter_allow(struct sk_buff *skb, struct net *net) else return false; rcu_read_lock(); - hlist_for_each_entry_rcu (entry, bucket, hash) { + hlist_for_each_entry_rcu(entry, bucket, hash) { if (entry->net == net && entry->ip == data.ip) { u64 now, tokens; bool ret; |