]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: convert more system1.Manager calls to BusLocator
authorDavid Tardon <dtardon@redhat.com>
Tue, 23 May 2023 18:09:37 +0000 (20:09 +0200)
committerDavid Tardon <dtardon@redhat.com>
Wed, 24 May 2023 06:23:59 +0000 (08:23 +0200)
src/home/homed-home.c
src/journal-remote/journal-gatewayd.c
src/login/logind-user.c
src/portable/portable.c
src/portable/portablectl.c
src/update-utmp/update-utmp.c

index 6e9cfd2776705df1995bea7a2480780eba5614d0..d16509d57437cc73b3a18b47e26885ad049a0d93 100644 (file)
@@ -11,6 +11,7 @@
 #include "blockdev-util.h"
 #include "btrfs-util.h"
 #include "bus-common-errors.h"
+#include "bus-locator.h"
 #include "data-fd-util.h"
 #include "env-util.h"
 #include "errno-list.h"
@@ -2117,15 +2118,7 @@ int home_killall(Home *h) {
         if (asprintf(&unit, "user-" UID_FMT ".slice", h->uid) < 0)
                 return log_oom();
 
-        r = sd_bus_call_method(
-                        h->manager->bus,
-                        "org.freedesktop.systemd1",
-                        "/org/freedesktop/systemd1",
-                        "org.freedesktop.systemd1.Manager",
-                        "KillUnit",
-                        &error,
-                        NULL,
-                        "ssi", unit, "all", SIGKILL);
+        r = bus_call_method(h->manager->bus, bus_systemd_mgr, "KillUnit", &error, NULL, "ssi", unit, "all", SIGKILL);
         if (r < 0)
                 log_full_errno(sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_UNIT) ? LOG_DEBUG : LOG_WARNING,
                                r, "Failed to kill login processes of user, ignoring: %s", bus_error_message(&error, r));
index b6e8469922f9bd75129439dcd7676df301b37d3e..4b4eec01855c66e84ad1857ead6568bc54246033 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "alloc-util.h"
 #include "build.h"
+#include "bus-locator.h"
 #include "bus-util.h"
 #include "errno-util.h"
 #include "fd-util.h"
@@ -704,14 +705,7 @@ static int get_virtualization(char **v) {
         if (r < 0)
                 return r;
 
-        r = sd_bus_get_property_string(
-                        bus,
-                        "org.freedesktop.systemd1",
-                        "/org/freedesktop/systemd1",
-                        "org.freedesktop.systemd1.Manager",
-                        "Virtualization",
-                        NULL,
-                        &b);
+        r = bus_get_property_string(bus, bus_systemd_mgr, "Virtualization", NULL, &b);
         if (r < 0)
                 return r;
 
index 3920467f444d997eca0f5a23b14e9e7c7d88d4da..6161af9a7453b10f433d2b8544997c2c9be821b9 100644 (file)
@@ -6,6 +6,7 @@
 #include "alloc-util.h"
 #include "bus-common-errors.h"
 #include "bus-error.h"
+#include "bus-locator.h"
 #include "bus-util.h"
 #include "cgroup-util.h"
 #include "clean-ipc.h"
@@ -388,13 +389,7 @@ static int user_update_slice(User *u) {
             u->user_record->io_weight == UINT64_MAX)
                 return 0;
 
-        r = sd_bus_message_new_method_call(
-                        u->manager->bus,
-                        &m,
-                        "org.freedesktop.systemd1",
-                        "/org/freedesktop/systemd1",
-                        "org.freedesktop.systemd1.Manager",
-                        "SetUnitProperties");
+        r = bus_message_new_method_call(u->manager->bus, &m, bus_systemd_mgr, "SetUnitProperties");
         if (r < 0)
                 return bus_log_create_error(r);
 
index e5f2f38a211a8bc797b3da1aaaafc5632989e3ed..7ab3ac6e97525bff924a2c23a853783f0a6169d8 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "bus-common-errors.h"
 #include "bus-error.h"
+#include "bus-locator.h"
 #include "chase.h"
 #include "conf-files.h"
 #include "copy.h"
@@ -780,13 +781,7 @@ static int unit_file_is_active(
                 _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
                 const char *at, *prefix, *joined;
 
-                r = sd_bus_message_new_method_call(
-                                bus,
-                                &m,
-                                "org.freedesktop.systemd1",
-                                "/org/freedesktop/systemd1",
-                                "org.freedesktop.systemd1.Manager",
-                                "ListUnitsByPatterns");
+                r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitsByPatterns");
                 if (r < 0)
                         return r;
 
index eec9c63d0b8ca0f1026c5b4ed6c2265ae7544784..39f17a8de7b0c15576d442fefac8bd1dce70dcac 100644 (file)
@@ -242,13 +242,7 @@ static int maybe_reload(sd_bus **bus) {
         if (r < 0)
                 return r;
 
-        r = sd_bus_message_new_method_call(
-                        *bus,
-                        &m,
-                        "org.freedesktop.systemd1",
-                        "/org/freedesktop/systemd1",
-                        "org.freedesktop.systemd1.Manager",
-                        "Reload");
+        r = bus_message_new_method_call(*bus, &m, bus_systemd_mgr, "Reload");
         if (r < 0)
                 return bus_log_create_error(r);
 
@@ -566,12 +560,10 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
         if (!names)
                 return log_oom();
 
-        r = sd_bus_message_new_method_call(
+        r = bus_message_new_method_call(
                 bus,
                 &m,
-                "org.freedesktop.systemd1",
-                "/org/freedesktop/systemd1",
-                "org.freedesktop.systemd1.Manager",
+                bus_systemd_mgr,
                 enable ? "EnableUnitFilesWithFlags" : "DisableUnitFilesWithFlags");
         if (r < 0)
                 return bus_log_create_error(r);
index 7449a2321c5a715e95d2876499cf127587dc55db..4996272eb3a148033ea9c04ab5e107e01c7031b4 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "alloc-util.h"
 #include "bus-error.h"
+#include "bus-locator.h"
 #include "bus-util.h"
 #include "format-util.h"
 #include "log.h"
@@ -50,14 +51,7 @@ static usec_t get_startup_monotonic_time(Context *c) {
 
         assert(c);
 
-        r = sd_bus_get_property_trivial(
-                        c->bus,
-                        "org.freedesktop.systemd1",
-                        "/org/freedesktop/systemd1",
-                        "org.freedesktop.systemd1.Manager",
-                        "UserspaceTimestampMonotonic",
-                        &error,
-                        't', &t);
+        r = bus_get_property_trivial(c->bus, bus_systemd_mgr, "UserspaceTimestampMonotonic", &error, 't', &t);
         if (r < 0) {
                 log_error_errno(r, "Failed to get timestamp: %s", bus_error_message(&error, r));
                 return 0;