From 6a7e98aacada79e273ddcad7335a7be7c2add801 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 15 Apr 2020 17:21:23 +0200 Subject: sd-bus: add helper struct for interface definitions The idea is to have a static table that defines the dbus API. The vtable is defined right next to the interface name and path because they are logically connected. --- src/shared/bus-log-control-api.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/shared/bus-log-control-api.c') diff --git a/src/shared/bus-log-control-api.c b/src/shared/bus-log-control-api.c index ffc52c7774..a1d0d17291 100644 --- a/src/shared/bus-log-control-api.c +++ b/src/shared/bus-log-control-api.c @@ -107,17 +107,8 @@ static const sd_bus_vtable log_control_vtable[] = { SD_BUS_VTABLE_END, }; -int bus_log_control_api_register(sd_bus *bus) { - int r; - - r = sd_bus_add_object_vtable( - bus, - NULL, - "/org/freedesktop/LogControl1", - "org.freedesktop.LogControl1", - log_control_vtable, NULL); - if (r < 0) - return log_error_errno(r, "Failed to register service API object: %m"); - - return 0; -} +const BusObjectImplementation log_control_object = { + "/org/freedesktop/LogControl1", + "org.freedesktop.LogControl1", + .vtables = BUS_VTABLES(log_control_vtable), +}; -- cgit v1.2.3