summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
authorQuentin Deslandes <qdeslandes@fb.com>2022-07-05 02:41:45 -0700
committerLennart Poettering <lennart@poettering.net>2022-07-05 16:40:16 +0200
commit57f28dee00effd7164bc89fa33bf16dc23fcc693 (patch)
tree660eed610e0bc0c081b952220226840f373babf7 /src/machine
parentb8df7f8629cb310beac982a4779b27eabe5362c6 (diff)
downloadsystemd-57f28dee00effd7164bc89fa33bf16dc23fcc693.tar.gz
machine: switch to BusLocator-oriented helpers
Replace existing sd_bus_x calls with counterparts from bus-locator.h.
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/machine.c7
-rw-r--r--src/machine/machinectl.c24
2 files changed, 7 insertions, 24 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c
index b202220b87..335a4e96fb 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -8,6 +8,7 @@
#include "alloc-util.h"
#include "bus-error.h"
+#include "bus-locator.h"
#include "bus-util.h"
#include "env-file.h"
#include "errno-util.h"
@@ -347,12 +348,10 @@ static int machine_start_scope(
if (!unit)
return log_oom();
- r = sd_bus_message_new_method_call(
+ r = bus_message_new_method_call(
machine->manager->bus,
&m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"StartTransientUnit");
if (r < 0)
return r;
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 34d1d9dd8e..213879c8ed 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1586,11 +1586,9 @@ static int start_machine(int argc, char *argv[], void *userdata) {
"Machine image '%s' does not exist.",
argv[i]);
- r = sd_bus_call_method(
+ r = bus_call_method(
bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"StartUnit",
&error,
&reply,
@@ -1629,13 +1627,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
method = streq(argv[0], "enable") ? "EnableUnitFiles" : "DisableUnitFiles";
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method);
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method);
if (r < 0)
return bus_log_create_error(r);
@@ -1688,15 +1680,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
if (r < 0)
goto finish;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "Reload",
- &error,
- NULL,
- NULL);
+ r = bus_call_method(bus, bus_systemd_mgr, "Reload", &error, NULL, NULL);
if (r < 0) {
log_error("Failed to reload daemon: %s", bus_error_message(&error, r));
goto finish;