mirror of
https://github.com/systemd/systemd.git
synced 2025-02-18 21:57:48 +03:00
machine: switch to BusLocator-oriented helpers
Replace existing sd_bus_x calls with counterparts from bus-locator.h.
This commit is contained in:
parent
b8df7f8629
commit
57f28dee00
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user