]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
event-util: move event_source_hash_ops to event-util
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 10 Mar 2025 10:29:51 +0000 (19:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 10 Mar 2025 20:48:19 +0000 (05:48 +0900)
src/libsystemd/sd-event/event-util.c
src/libsystemd/sd-event/event-util.h
src/mountfsd/mountfsd-manager.c
src/nsresourced/nsresourced-manager.c
src/userdb/userdbd-manager.c

index 9e0dbd30c3b0d42bbfe3be1b902208c47a63c88f..47cf76f9c2c9f6ae629e7c0458bf887a676f8d45 100644 (file)
 #define SI_FLAG_FORWARD  (INT32_C(1) << 30)
 #define SI_FLAG_POSITIVE (INT32_C(1) << 29)
 
+DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
+                event_source_hash_ops,
+                sd_event_source,
+                (void (*)(const sd_event_source*, struct siphash*)) trivial_hash_func,
+                (int (*)(const sd_event_source*, const sd_event_source*)) trivial_compare_func,
+                sd_event_source_disable_unref);
+
 int event_reset_time(
                 sd_event *e,
                 sd_event_source **s,
index 2c6fcccb90850e2be674ce899ee99396c784e8cf..3d5ee4d33107c4f07bdc809232c7e6e4740157a0 100644 (file)
@@ -5,8 +5,11 @@
 
 #include "sd-event.h"
 
+#include "hash-funcs.h"
 #include "pidref.h"
 
+extern const struct hash_ops event_source_hash_ops;
+
 int event_reset_time(
                 sd_event *e,
                 sd_event_source **s,
index b05c6e8493b153b417631085e327befc087cf8ec..215dcb5b2fa386da4f0c55543634dd3ddb11d8d8 100644 (file)
@@ -6,6 +6,7 @@
 #include "build-path.h"
 #include "common-signal.h"
 #include "env-util.h"
+#include "event-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
 #include "mkdir.h"
@@ -58,13 +59,6 @@ static int on_sigusr2(sd_event_source *s, const struct signalfd_siginfo *si, voi
         return 0;
 }
 
-DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
-                event_source_hash_ops,
-                sd_event_source,
-                (void (*)(const sd_event_source*, struct siphash*)) trivial_hash_func,
-                (int (*)(const sd_event_source*, const sd_event_source*)) trivial_compare_func,
-                sd_event_source_disable_unref);
-
 int manager_new(Manager **ret) {
         _cleanup_(manager_freep) Manager *m = NULL;
         int r;
index 152b506da52d247ce8b66e73d7daa51bf19fd507..7fac1828ca2fe2c799b457fb3e4cca63875e4812 100644 (file)
@@ -12,6 +12,7 @@
 #include "build-path.h"
 #include "common-signal.h"
 #include "env-util.h"
+#include "event-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
 #include "mkdir.h"
@@ -79,13 +80,6 @@ static int on_deferred_start_worker(sd_event_source *s, uint64_t usec, void *use
         return 0;
 }
 
-DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
-                event_source_hash_ops,
-                sd_event_source,
-                (void (*)(const sd_event_source*, struct siphash*)) trivial_hash_func,
-                (int (*)(const sd_event_source*, const sd_event_source*)) trivial_compare_func,
-                sd_event_source_disable_unref);
-
 int manager_new(Manager **ret) {
         _cleanup_(manager_freep) Manager *m = NULL;
         int r;
index 5925602e43369e8a46061632e8462f300e3526f2..3d3ac8fdc63255c26756e9e800abf11f767109fd 100644 (file)
@@ -7,6 +7,7 @@
 #include "build-path.h"
 #include "common-signal.h"
 #include "env-util.h"
+#include "event-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
 #include "mkdir.h"
@@ -67,13 +68,6 @@ static int on_deferred_start_worker(sd_event_source *s, uint64_t usec, void *use
         return 0;
 }
 
-DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
-                event_source_hash_ops,
-                sd_event_source,
-                (void (*)(const sd_event_source*, struct siphash*)) trivial_hash_func,
-                (int (*)(const sd_event_source*, const sd_event_source*)) trivial_compare_func,
-                sd_event_source_disable_unref);
-
 int manager_new(Manager **ret) {
         _cleanup_(manager_freep) Manager *m = NULL;
         int r;