From: Lennart Poettering Date: Fri, 28 Feb 2025 08:50:29 +0000 (+0100) Subject: pidref: export hash funcs X-Git-Tag: v258-rc1~1218^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ad187fb68cd1fed199a8a6da502d55d627df1c7;p=thirdparty%2Fsystemd.git pidref: export hash funcs That way we can use them for definition of additional hash_ops that map pidrefs to arbitrary other resources. --- diff --git a/src/basic/pidref.c b/src/basic/pidref.c index 9b4922b1607..ef52cd7a421 100644 --- a/src/basic/pidref.c +++ b/src/basic/pidref.c @@ -457,11 +457,11 @@ bool pidref_is_automatic(const PidRef *pidref) { return pidref && pid_is_automatic(pidref->pid); } -static void pidref_hash_func(const PidRef *pidref, struct siphash *state) { +void pidref_hash_func(const PidRef *pidref, struct siphash *state) { siphash24_compress_typesafe(pidref->pid, state); } -static int pidref_compare_func(const PidRef *a, const PidRef *b) { +int pidref_compare_func(const PidRef *a, const PidRef *b) { return CMP(a->pid, b->pid); } diff --git a/src/basic/pidref.h b/src/basic/pidref.h index 0198db8f8eb..b71c3bd9d0c 100644 --- a/src/basic/pidref.h +++ b/src/basic/pidref.h @@ -108,5 +108,9 @@ int pidref_verify(const PidRef *pidref); #define TAKE_PIDREF(p) TAKE_GENERIC((p), PidRef, PIDREF_NULL) +struct siphash; +void pidref_hash_func(const PidRef *pidref, struct siphash *state); +int pidref_compare_func(const PidRef *a, const PidRef *b); + extern const struct hash_ops pidref_hash_ops; extern const struct hash_ops pidref_hash_ops_free; /* Has destructor call for pidref_free(), i.e. expects heap allocated PidRef as keys */