]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus: move bus_verify_xyz() to dbus-util.c
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Oct 2024 21:08:11 +0000 (06:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Oct 2024 21:54:45 +0000 (06:54 +0900)
src/core/dbus-manager.c
src/core/dbus-util.c
src/core/dbus-util.h
src/core/dbus.c
src/core/dbus.h

index 91c10a4e00c3f16e0f1c43b97ed5176da5dfa89c..3538296d64b7d2720b3d15de27fc502679d78e2c 100644 (file)
@@ -22,6 +22,7 @@
 #include "dbus-scope.h"
 #include "dbus-service.h"
 #include "dbus-unit.h"
+#include "dbus-util.h"
 #include "dbus.h"
 #include "env-util.h"
 #include "fd-util.h"
index b871d89368227c29585acc1514df2d7bb5e0cf45..28cb095cb279901e9e0599d44416c4a6b00dc106 100644 (file)
@@ -177,6 +177,50 @@ int bus_verify_manage_units_async_full(
                         error);
 }
 
+int bus_verify_manage_units_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
+        return bus_verify_polkit_async(
+                        call,
+                        "org.freedesktop.systemd1.manage-units",
+                        /* details= */ NULL,
+                        &m->polkit_registry,
+                        error);
+}
+
+int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
+        return bus_verify_polkit_async(
+                        call,
+                        "org.freedesktop.systemd1.manage-unit-files",
+                        /* details= */ NULL,
+                        &m->polkit_registry,
+                        error);
+}
+
+int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
+        return bus_verify_polkit_async(
+                        call,
+                        "org.freedesktop.systemd1.reload-daemon",
+                        /* details= */ NULL,
+                        &m->polkit_registry, error);
+}
+
+int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
+        return bus_verify_polkit_async(
+                        call,
+                        "org.freedesktop.systemd1.set-environment",
+                        /* details= */ NULL,
+                        &m->polkit_registry,
+                        error);
+}
+
+int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
+        return bus_verify_polkit_async(
+                        call,
+                        "org.freedesktop.systemd1.bypass-dump-ratelimit",
+                        /* details= */ NULL,
+                        &m->polkit_registry,
+                        error);
+}
+
 /* ret_format_str is an accumulator, so if it has any pre-existing content, new options will be appended to it */
 int bus_read_mount_options(
                 sd_bus_message *message,
index 0fc3a949610a734a2c70b2d67bd0fbec4ede0ec0..5eb4e836c722a5dde81ff411f58f3f8650c08df2 100644 (file)
@@ -250,7 +250,13 @@ static inline int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, s
 static inline int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) {
         return bus_set_transient_usec_internal(u, name, p, true, message, flags, error);
 }
+
 int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_manage_units_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
 
 int bus_read_mount_options(sd_bus_message *message, sd_bus_error *error, MountOptions **ret_options, char **ret_format_str, const char *separator);
 
index b6480937ee14985885e3d93344737d708d70dca1..2692dde1518ad79488b45fbbac95e4312c87d2f5 100644 (file)
@@ -1172,49 +1172,6 @@ int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l) {
         return bus_track_add_name_many(*t, l);
 }
 
-int bus_verify_manage_units_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
-        return bus_verify_polkit_async(
-                        call,
-                        "org.freedesktop.systemd1.manage-units",
-                        /* details= */ NULL,
-                        &m->polkit_registry,
-                        error);
-}
-
-int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
-        return bus_verify_polkit_async(
-                        call,
-                        "org.freedesktop.systemd1.manage-unit-files",
-                        /* details= */ NULL,
-                        &m->polkit_registry,
-                        error);
-}
-
-int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
-        return bus_verify_polkit_async(
-                        call,
-                        "org.freedesktop.systemd1.reload-daemon",
-                        /* details= */ NULL,
-                        &m->polkit_registry, error);
-}
-
-int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
-        return bus_verify_polkit_async(
-                        call,
-                        "org.freedesktop.systemd1.set-environment",
-                        /* details= */ NULL,
-                        &m->polkit_registry,
-                        error);
-}
-int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
-        return bus_verify_polkit_async(
-                        call,
-                        "org.freedesktop.systemd1.bypass-dump-ratelimit",
-                        /* details= */ NULL,
-                        &m->polkit_registry,
-                        error);
-}
-
 uint64_t manager_bus_n_queued_write(Manager *m) {
         uint64_t c = 0;
         sd_bus *b;
index ae754040761e11a0d01bd769d38e13875047923d..d00c14d3b72ed492434613335d8e93962ac4906a 100644 (file)
@@ -23,12 +23,6 @@ int bus_track_coldplug(Manager *m, sd_bus_track **t, bool recursive, char **l);
 
 int bus_foreach_bus(Manager *m, sd_bus_track *subscribed2, int (*send_message)(sd_bus *bus, void *userdata), void *userdata);
 
-int bus_verify_manage_units_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
-int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
-int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
-int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
-int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
-
 int bus_forward_agent_released(Manager *m, const char *path);
 
 uint64_t manager_bus_n_queued_write(Manager *m);