src: changed instances of sd_bus_call_method() to bus_call_method() (#26819)

* src: changed instances of sd_bus_call_method() to bus_call_method()
This commit is contained in:
OMOJOLA JOSHUA
2023-03-15 01:12:57 +01:00
committed by GitHub
parent c1c4ecd356
commit 59228d0dbf
5 changed files with 9 additions and 42 deletions

View File

@@ -17,6 +17,7 @@
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "device-util.h"
#include "fd-util.h"
@@ -53,14 +54,7 @@ static void start_target(const char *target, const char *mode) {
log_info("Requesting %s/start/%s", target, mode);
/* Start this unit only if we can replace basic.target with it */
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnitReplace",
&error,
NULL,
"sss", "basic.target", target, mode);
r = bus_call_method(bus, bus_systemd_mgr, "StartUnitReplace", &error, NULL, "sss", "basic.target", target, mode);
/* Don't print a warning if we aren't called during startup */
if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))

View File

@@ -627,14 +627,7 @@ static int do_daemon_reload(void) {
FOREACH_STRING(unit, SPECIAL_INITRD_FS_TARGET, SPECIAL_SWAP_TARGET) {
log_info("Requesting %s/start/replace...", unit);
k = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnit",
&error,
NULL,
"ss", unit, "replace");
k = bus_call_method(bus, bus_systemd_mgr, "StartUnit", &error, NULL, "ss", unit, "replace");
if (k < 0) {
log_error_errno(k, "Failed to (re)start %s: %s", unit, bus_error_message(&error, r));
if (r == 0)

View File

@@ -13,6 +13,7 @@
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "constants.h"
#include "daemon-util.h"
@@ -106,15 +107,7 @@ static int change_runlevel(Server *s, int runlevel) {
log_debug("Requesting %s/start/%s", target, mode);
r = sd_bus_call_method(
s->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnit",
&error,
NULL,
"ss", target, mode);
r = bus_call_method(s->bus, bus_systemd_mgr, "StartUnit", &error, NULL, "ss", target, mode);
if (r < 0)
return log_error_errno(r, "Failed to change runlevel: %s", bus_error_message(&error, r));

View File

@@ -14,6 +14,7 @@
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-log-control-api.h"
#include "bus-message.h"
#include "bus-polkit.h"
@@ -60,14 +61,7 @@ static int vconsole_reload(sd_bus *bus) {
assert(bus);
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"RestartUnit",
&error,
NULL,
"ss", "systemd-vconsole-setup.service", "replace");
r = bus_call_method(bus, bus_systemd_mgr, "RestartUnit", &error, NULL, "ss", "systemd-vconsole-setup.service", "replace");
if (r < 0)
return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, r));

View File

@@ -9,6 +9,7 @@
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "conf-parser.h"
@@ -538,15 +539,7 @@ int manager_spawn_autovt(Manager *m, unsigned vtnr) {
}
xsprintf(name, "autovt@tty%u.service", vtnr);
r = sd_bus_call_method(
m->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnit",
&error,
NULL,
"ss", name, "fail");
r = bus_call_method(m->bus, bus_systemd_mgr, "StartUnit", &error, NULL, "ss", name, "fail");
if (r < 0)
return log_error_errno(r, "Failed to start %s: %s", name, bus_error_message(&error, r));