diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-24 09:51:30 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-25 07:38:59 +0100 |
commit | c01a5c0527b7c49d4b10f5d525de060feb2b37f2 (patch) | |
tree | 9831d585e249cbcb21ccb24194e93e48dfff3aab /src/storagetm | |
parent | resolve: don't add sockets to the graveyard on shutdown (diff) | |
download | systemd-c01a5c0527b7c49d4b10f5d525de060feb2b37f2.tar.xz systemd-c01a5c0527b7c49d4b10f5d525de060feb2b37f2.zip |
siphash24: introduce siphash24_compress_typesafe() macro
To prevent copy-and-paste mistake.
This also introduce in_addr_hash_func().
No functional change, just refactoring.
Diffstat (limited to 'src/storagetm')
-rw-r--r-- | src/storagetm/storagetm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c index a482daabef..b28924a8b4 100644 --- a/src/storagetm/storagetm.c +++ b/src/storagetm/storagetm.c @@ -587,7 +587,7 @@ static uint16_t calculate_start_port(const char *name, int ip_family) { /* Use some fixed key Lennart pulled from /dev/urandom, so that we are deterministic */ siphash24_init(&state, SD_ID128_MAKE(d1,0b,67,b5,e2,b7,4a,91,8d,6b,27,b6,35,c1,9f,d9).bytes); siphash24_compress_string(name, &state); - siphash24_compress(&ip_family, sizeof(ip_family), &state); + siphash24_compress_typesafe(ip_family, &state); nr = 1024U + siphash24_finalize(&state) % (0xFFFFU - 1024U); SET_FLAG(nr, 1, ip_family == AF_INET6); /* Lowest bit reflects family */ @@ -790,8 +790,8 @@ static void device_hash_func(const struct stat *q, struct siphash *state) { if (S_ISBLK(q->st_mode) || S_ISCHR(q->st_mode)) { mode_t m = q->st_mode & S_IFMT; - siphash24_compress(&m, sizeof(m), state); - siphash24_compress(&q->st_rdev, sizeof(q->st_rdev), state); + siphash24_compress_typesafe(m, state); + siphash24_compress_typesafe(q->st_rdev, state); return; } |