aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/hashtables.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-25 17:56:08 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-31 17:25:23 +0100
commite09ec4dc2af38fb44add2fac518a726ae605b400 (patch)
tree950512f15664d121e92677ec1c35a5b1b1b870dc /src/hashtables.c
parentqemu: work around ccache bugs (diff)
downloadwireguard-monolithic-historical-e09ec4dc2af38fb44add2fac518a726ae605b400.tar.xz
wireguard-monolithic-historical-e09ec4dc2af38fb44add2fac518a726ae605b400.zip
global: style nits
Diffstat (limited to '')
-rw-r--r--src/hashtables.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/hashtables.c b/src/hashtables.c
index a0c0c64..8d61f4c 100644
--- a/src/hashtables.c
+++ b/src/hashtables.c
@@ -7,7 +7,8 @@
static inline struct hlist_head *pubkey_bucket(struct pubkey_hashtable *table, const u8 pubkey[NOISE_PUBLIC_KEY_LEN])
{
/* siphash gives us a secure 64bit number based on a random key. Since the bits are
- * uniformly distributed, we can then mask off to get the bits we need. */
+ * uniformly distributed, we can then mask off to get the bits we need.
+ */
return &table->hashtable[siphash(pubkey, NOISE_PUBLIC_KEY_LEN, &table->key) & (HASH_SIZE(table->hashtable) - 1)];
}
@@ -52,7 +53,8 @@ struct wireguard_peer *pubkey_hashtable_lookup(struct pubkey_hashtable *table, c
static inline struct hlist_head *index_bucket(struct index_hashtable *table, const __le32 index)
{
/* Since the indices are random and thus all bits are uniformly distributed,
- * we can find its bucket simply by masking. */
+ * we can find its bucket simply by masking.
+ */
return &table->hashtable[(__force u32)index & (HASH_SIZE(table->hashtable) - 1)];
}
@@ -103,7 +105,8 @@ search_unused_slot:
}
/* Once we've found an unused slot, we lock it, and then double-check
- * that nobody else stole it from us. */
+ * that nobody else stole it from us.
+ */
spin_lock_bh(&table->lock);
hlist_for_each_entry_rcu_bh(existing_entry, index_bucket(table, entry->index), index_hash) {
if (existing_entry->index == entry->index) {