]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pidref: export hash funcs
authorLennart Poettering <lennart@poettering.net>
Fri, 28 Feb 2025 08:50:29 +0000 (09:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 28 Feb 2025 13:18:07 +0000 (14:18 +0100)
That way we can use them for definition of additional hash_ops that map
pidrefs to arbitrary other resources.

src/basic/pidref.c
src/basic/pidref.h

index 9b4922b16075e68f077a1cd6590b345e071e6e6c..ef52cd7a42125c0e1dd613ce92f8b843010dad37 100644 (file)
@@ -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);
 }
 
index 0198db8f8eb5ca25f7c41ff814ab2b55d89fb65f..b71c3bd9d0c6d5cf003c525f3bdeb17e482478f0 100644 (file)
@@ -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 */