X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fdbus-snapshot.c;h=0967034f0342dfb04fa202009389f466f57104f8;hp=8aeca15254e0870b7d22e54bdb9debba6aae05ea;hb=ac155bb885f9ea8aac3979a6b2686f0c8a9cc6e3;hpb=e99e38bbdcca3fe5956823bdb3d38544ccf93221 diff --git a/src/dbus-snapshot.c b/src/dbus-snapshot.c index 8aeca1525..0967034f0 100644 --- a/src/dbus-snapshot.c +++ b/src/dbus-snapshot.c @@ -1,4 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ /*** This file is part of systemd. @@ -21,23 +21,35 @@ #include "dbus-unit.h" #include "dbus-snapshot.h" - -static const char introspection[] = - DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE - "" - BUS_UNIT_INTERFACE - BUS_PROPERTIES_INTERFACE - " " - " " - " " - " " - BUS_INTROSPECTABLE_INTERFACE - ""; - -DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message) { +#include "dbus-common.h" + +#define BUS_SNAPSHOT_INTERFACE \ + " \n" \ + " \n" \ + " \n" \ + " \n" + +#define INTROSPECTION \ + DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ + "\n" \ + BUS_UNIT_INTERFACE \ + BUS_SNAPSHOT_INTERFACE \ + BUS_PROPERTIES_INTERFACE \ + BUS_PEER_INTERFACE \ + BUS_INTROSPECTABLE_INTERFACE \ + "\n" + +#define INTERFACES_LIST \ + BUS_UNIT_INTERFACES_LIST \ + "org.freedesktop.systemd1.Snapshot\0" + +const char bus_snapshot_interface[] _introspect_("Snapshot") = BUS_SNAPSHOT_INTERFACE; + +DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { + Snapshot *s = SNAPSHOT(u); const BusProperty properties[] = { BUS_UNIT_PROPERTIES, - { "org.freedesktop.systemd1.Snapshot", "Cleanup", bus_property_append_bool, "b", &u->snapshot.cleanup }, + { "org.freedesktop.systemd1.Snapshot", "Cleanup", bus_property_append_bool, "b", &s->cleanup }, { NULL, NULL, NULL, NULL, NULL } }; @@ -54,10 +66,10 @@ DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message) { goto oom; } else - return bus_default_message_handler(u->meta.manager, message, introspection, properties); + return bus_default_message_handler(c, message, INTROSPECTION, INTERFACES_LIST, properties); if (reply) { - if (!dbus_connection_send(u->meta.manager->api_bus, reply, NULL)) + if (!dbus_connection_send(c, reply, NULL)) goto oom; dbus_message_unref(reply);