From: Zbigniew Jędrzejewski-Szmek Date: Thu, 23 Apr 2020 10:14:09 +0000 (+0200) Subject: timedated: convert to the new scheme and add --bus-introspect X-Git-Tag: v246-rc1~433^2~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c4b7d95c46194c744945d8ab1256adc5dd6a4951;p=thirdparty%2Fsystemd.git timedated: convert to the new scheme and add --bus-introspect --- diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 7f2e3019d42..19e51b063a1 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -14,6 +14,7 @@ #include "bus-error.h" #include "bus-log-control-api.h" #include "bus-polkit.h" +#include "bus-util.h" #include "clock-util.h" #include "conf-files.h" #include "def.h" @@ -1086,6 +1087,12 @@ static const sd_bus_vtable timedate_vtable[] = { SD_BUS_VTABLE_END, }; +const BusObjectImplementation manager_object = { + "/org/freedesktop/timedate1", + "org.freedesktop.timedate1", + .vtables = BUS_VTABLES(timedate_vtable), +}; + static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; int r; @@ -1098,9 +1105,9 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { if (r < 0) return log_error_errno(r, "Failed to get system bus connection: %m"); - r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", timedate_vtable, c); + r = bus_add_implementation(bus, &manager_object, c); if (r < 0) - return log_error_errno(r, "Failed to register object: %m"); + return r; r = bus_log_control_api_register(bus); if (r < 0) @@ -1129,7 +1136,8 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-timedated.service", "Manage the system clock and timezone and NTP enablement.", - NULL, + BUS_IMPLEMENTATIONS(&manager_object, + &log_control_object), argc, argv); if (r <= 0) return r;