diff options
author | David Tardon <dtardon@redhat.com> | 2023-05-23 20:09:37 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2023-05-24 08:23:59 +0200 |
commit | b71471684afa7972b6328e99a554098c032c0caf (patch) | |
tree | 98b8a7549162ca63bc73af384edad675cd94dc59 | |
parent | core/slice: shorten code a bit (diff) | |
download | systemd-b71471684afa7972b6328e99a554098c032c0caf.tar.xz systemd-b71471684afa7972b6328e99a554098c032c0caf.zip |
tree-wide: convert more system1.Manager calls to BusLocator
-rw-r--r-- | src/home/homed-home.c | 11 | ||||
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 10 | ||||
-rw-r--r-- | src/login/logind-user.c | 9 | ||||
-rw-r--r-- | src/portable/portable.c | 9 | ||||
-rw-r--r-- | src/portable/portablectl.c | 14 | ||||
-rw-r--r-- | src/update-utmp/update-utmp.c | 10 |
6 files changed, 13 insertions, 50 deletions
diff --git a/src/home/homed-home.c b/src/home/homed-home.c index 6e9cfd2776..d16509d574 100644 --- a/src/home/homed-home.c +++ b/src/home/homed-home.c @@ -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)); diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index b6e8469922..4b4eec0185 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -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; diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 3920467f44..6161af9a74 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -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); diff --git a/src/portable/portable.c b/src/portable/portable.c index e5f2f38a21..7ab3ac6e97 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -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; diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index eec9c63d0b..39f17a8de7 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -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); diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index 7449a2321c..4996272eb3 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -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; |