summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-06 15:04:42 +0200
committerTom Gundersen <teg@jklm.no>2015-10-06 17:47:00 +0200
commit0cb3c286883b694fc52a18a3b559ff98931641f3 (patch)
treef8c3cf9104b3ea8fc180bd1de1e72119dfe4524e /src/journal
parent8c60d978bd3453659bfa7f4d90a17ba5fa3e0774 (diff)
siphash24: unify API
Make the API of the new helpers more similar to the old wrapper. In particular we now return the hash as a byte string to avoid any endianness problems.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-rate-limit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c
index 7e06117b31..8afd493b50 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -57,7 +57,7 @@ struct JournalRateLimitGroup {
char *id;
JournalRateLimitPool pools[POOLS_MAX];
- unsigned long hash;
+ uint64_t hash;
LIST_FIELDS(JournalRateLimitGroup, bucket);
LIST_FIELDS(JournalRateLimitGroup, lru);
@@ -158,9 +158,9 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
if (!g->id)
goto fail;
- siphash_init(&state, r->hash_key);
+ siphash24_init(&state, r->hash_key);
string_hash_func(g->id, &state);
- g->hash = siphash24_finalize(&state);
+ siphash24_finalize((uint8_t*)&g->hash, &state);
journal_rate_limit_vacuum(r, ts);
@@ -207,7 +207,7 @@ static unsigned burst_modulate(unsigned burst, uint64_t available) {
}
int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, uint64_t available) {
- unsigned long h;
+ uint64_t h;
JournalRateLimitGroup *g;
JournalRateLimitPool *p;
struct siphash state;
@@ -226,9 +226,9 @@ int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, u
ts = now(CLOCK_MONOTONIC);
- siphash_init(&state, r->hash_key);
+ siphash24_init(&state, r->hash_key);
string_hash_func(id, &state);
- h = siphash24_finalize(&state);
+ siphash24_finalize((uint8_t*)&h, &state);
g = r->buckets[h % BUCKETS_MAX];
LIST_FOREACH(bucket, g, g)