]> err.no Git - systemd/commitdiff
dbus: automatically generate and install introspection files
authorLennart Poettering <lennart@poettering.net>
Sun, 23 May 2010 01:45:33 +0000 (03:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 23 May 2010 01:45:33 +0000 (03:45 +0200)
29 files changed:
.gitignore
Makefile.am
fixme
src/dbus-automount.c
src/dbus-automount.h
src/dbus-device.c
src/dbus-device.h
src/dbus-execute.h
src/dbus-job.c
src/dbus-job.h
src/dbus-manager.c
src/dbus-manager.h
src/dbus-mount.c
src/dbus-mount.h
src/dbus-service.c
src/dbus-service.h
src/dbus-snapshot.c
src/dbus-snapshot.h
src/dbus-socket.c
src/dbus-socket.h
src/dbus-swap.c
src/dbus-swap.h
src/dbus-target.c
src/dbus-target.h
src/dbus-unit.c
src/dbus-unit.h
src/dbus.c
src/dbus.h
src/main.c

index 700a085ad76764159bb305edadc25210e31ed073..de52b6fbd68e60a2751bc1b8e5fee41f3ae8d004 100644 (file)
@@ -1,3 +1,4 @@
+org.freedesktop.systemd1.*.xml
 test-ns
 test-loopback
 systemd-cgroups-agent
index ffa9ad9a8290f7af5da9890a83d0ba81841be8b6..b3e9dfde811e9990572cc944ae961505f28025a6 100644 (file)
@@ -23,6 +23,7 @@ udevrulesdir=@udevrulesdir@
 pkgsysconfdir=$(sysconfdir)/systemd
 systemunitdir=$(pkgdatadir)/system
 sessionunitdir=$(pkgdatadir)/session
+interfacedir=$(datadir)/dbus-1/interfaces
 
 AM_CPPFLAGS = \
         -include $(top_builddir)/config.h \
@@ -64,6 +65,19 @@ dist_dbuspolicy_DATA = \
 dist_udevrules_DATA = \
        src/99-systemd.rules
 
+interface_DATA = \
+       org.freedesktop.systemd1.Manager.xml \
+       org.freedesktop.systemd1.Job.xml \
+       org.freedesktop.systemd1.Unit.xml \
+       org.freedesktop.systemd1.Service.xml \
+       org.freedesktop.systemd1.Socket.xml \
+       org.freedesktop.systemd1.Target.xml \
+       org.freedesktop.systemd1.Device.xml \
+       org.freedesktop.systemd1.Mount.xml \
+       org.freedesktop.systemd1.Automount.xml \
+       org.freedesktop.systemd1.Snapshot.xml \
+       org.freedesktop.systemd1.Swap.xml
+
 dist_systemunit_DATA = \
        units/emergency.service \
        units/getty.target \
@@ -426,6 +440,11 @@ CLEANFILES += \
        man/systemd.special.html.in
 endif
 
+org.freedesktop.systemd1.%.xml: systemd
+       $(AM_V_GEN)./systemd --introspect=${@:.xml=} > $@
+
+CLEANFILES += $(interface_DATA)
+
 install-data-hook:
        $(MKDIR_P) -m 0755 \
                $(DESTDIR)$(systemunitdir) \
diff --git a/fixme b/fixme
index b6752d9bf6066ed9617f283c3de9a3c58ce03188..6b6f7f7d0a868efddb485c98282e929477c60306 100644 (file)
--- a/fixme
+++ b/fixme
@@ -64,6 +64,8 @@
 
 * tcpwrap
 
+* introduce exit.target for session instances
+
 Regularly:
 
 * look for close() vs. close_nointr() vs. close_nointr_nofail()
index 9003b74b8acdee05b1cdd0492e1b93c034b7ce54..285f666da91b2cda1113a07f42278d9ebd6e4216 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-automount.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Automount\">"
-        "  <property name=\"Where\" type=\"s\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_AUTOMOUNT_INTERFACE                                      \
+        " <interface name=\"org.freedesktop.systemd1.Automount\">\n" \
+        "  <property name=\"Where\" type=\"s\" access=\"read\"/>\n"  \
+        " </interface>\n"
+
+#define INTROSPECTION                                                \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                    \
+        "<node>\n"                                                   \
+        BUS_UNIT_INTERFACE                                           \
+        BUS_AUTOMOUNT_INTERFACE                                      \
+        BUS_PROPERTIES_INTERFACE                                     \
+        BUS_INTROSPECTABLE_INTERFACE                                 \
+        "</node>\n"
+
+const char bus_automount_interface[] = BUS_AUTOMOUNT_INTERFACE;
 
 DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message) {
         const BusProperty properties[] = {
@@ -40,5 +45,5 @@ DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index 947bf0f59fdacc282e17a412eec5c6a277de580d..5e0ee5107b69b992ac8686fe740e8055f32ca4fe 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_automount_interface[];
+
 #endif
index 83764783adc11a3373c8e7af7ad996f1da6943d3..0610ab873ff931b5aeb62c777bb147cf9f6bac97 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-device.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Device\">"
-        "  <property name=\"SysFSPath\" type=\"s\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_DEVICE_INTERFACE                                            \
+        " <interface name=\"org.freedesktop.systemd1.Device\">\n"       \
+        "  <property name=\"SysFSPath\" type=\"s\" access=\"read\"/>\n" \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_DEVICE_INTERFACE                                            \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_device_interface[] = BUS_DEVICE_INTERFACE;
 
 DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message) {
         const BusProperty properties[] = {
@@ -40,5 +45,5 @@ DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index f2850a63f832326671ca0919af4b21cab35e32f0..55bb8f55f3e312a58de82f06c9259b346a6966df 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_device_interface[];
+
 #endif
index 25ecd982a43c4c25f05107559364c088a683a6cd..6abae1657c16240524a8432d99aa0a6f3d0e21b1 100644 (file)
 #include "manager.h"
 
 #define BUS_EXEC_CONTEXT_INTERFACE                                      \
-        "  <property name=\"Environment\" type=\"as\" access=\"read\"/>" \
-        "  <property name=\"UMask\" type=\"u\" access=\"read\"/>"       \
-        "  <property name=\"WorkingDirectory\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"RootDirectory\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>" \
-        "  <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>" \
-        "  <property name=\"StandardInput\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"StandardOutput\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"StandardError\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"TTYPath\" type=\"s\" access=\"read\"/>"     \
-        "  <property name=\"SyslogPriority\" type=\"i\" access=\"read\"/>" \
-        "  <property name=\"SyslogIdentifier\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"SecureBits\" type=\"i\" access=\"read\"/> \
-        "  <property name=\"CapabilityBoundingSetDrop\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"User\" type=\"s\" access=\"read\"/>"        \
-        "  <property name=\"Group\" type=\"s\" access=\"read\"/>"       \
-        "  <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>"
+        "  <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"UMask\" type=\"u\" access=\"read\"/>\n"     \
+        "  <property name=\"WorkingDirectory\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"RootDirectory\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"StandardInput\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"StandardOutput\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"StandardError\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"TTYPath\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"SyslogPriority\" type=\"i\" access=\"read\"/>\n" \
+        "  <property name=\"SyslogIdentifier\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"SecureBits\" type=\"i\" access=\"read\"/>\n" \
+        "  <property name=\"CapabilityBoundingSetDrop\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"User\" type=\"s\" access=\"read\"/>\n"      \
+        "  <property name=\"Group\" type=\"s\" access=\"read\"/>\n"     \
+        "  <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>\n"
 
 #define BUS_EXEC_CONTEXT_PROPERTIES(interface, context)                 \
         { interface, "Environment",                   bus_property_append_strv,   "as",    (context).environment                   }, \
index 34e64fc6812e457de3b36255956a6efdea230a0a..7346252a18a965168c8e660565d25af9dfb6c8e2 100644 (file)
 #include "log.h"
 #include "dbus-job.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        " <interface name=\"org.freedesktop.systemd1.Job\">"
-        "  <method name=\"Cancel\"/>"
-        "  <signal name=\"Changed\"/>"
-        "  <property name=\"Id\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"Unit\" type=\"(so)\" access=\"read\"/>"
-        "  <property name=\"JobType\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"State\" type=\"s\" access=\"read\"/>"
-        " </interface>"
-        BUS_PROPERTIES_INTERFACE
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_JOB_INTERFACE                                             \
+        " <interface name=\"org.freedesktop.systemd1.Job\">\n"        \
+        "  <method name=\"Cancel\"/>\n"                               \
+        "  <signal name=\"Changed\"/>\n"                              \
+        "  <property name=\"Id\" type=\"u\" access=\"read\"/>\n"      \
+        "  <property name=\"Unit\" type=\"(so)\" access=\"read\"/>\n" \
+        "  <property name=\"JobType\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"State\" type=\"s\" access=\"read\"/>\n"   \
+        " </interface>\n"
+
+#define INTROSPECTION                                                 \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                     \
+        "<node>\n"                                                    \
+        BUS_JOB_INTERFACE                                             \
+        BUS_PROPERTIES_INTERFACE                                      \
+        BUS_INTROSPECTABLE_INTERFACE                                  \
+        "</node>\n"
+
+const char bus_job_interface[] = BUS_JOB_INTERFACE;
 
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_job_append_state, job_state, JobState);
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_job_append_type, job_type, JobType);
@@ -92,7 +97,7 @@ static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusMessage *message)
                 job_free(j);
 
         } else
-                return bus_default_message_handler(j->manager, message, introspection, properties);
+                return bus_default_message_handler(j->manager, message, INTROSPECTION, properties);
 
         if (reply) {
                 if (!dbus_connection_send(m->api_bus, reply, NULL))
index 460235885645f93a6189de70f270716cb33f38cd..2b79423f01b73e45fbf327f9d2c3fb87324e1691 100644 (file)
@@ -29,4 +29,6 @@ void bus_job_send_removed_signal(Job *j, bool success);
 
 extern const DBusObjectPathVTable bus_job_vtable;
 
+extern const char bus_job_interface[];
+
 #endif
index 9833b6c85f9b616e16b74c6a5ed1372b5ea04744..6b658d1931e7d46819f626715d4f54e7b4396684 100644 (file)
 #include "dbus-manager.h"
 #include "strv.h"
 
+#define BUS_MANAGER_INTERFACE                                           \
+        " <interface name=\"org.freedesktop.systemd1.Manager\">\n"      \
+        "  <method name=\"GetUnit\">\n"                                 \
+        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>\n"        \
+        "  </method>\n"                                                 \
+        "  <method name=\"LoadUnit\">\n"                                \
+        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>\n"        \
+        "  </method>\n"                                                 \
+        "  <method name=\"GetJob\">\n"                                  \
+        "   <arg name=\"id\" type=\"u\" direction=\"in\"/>\n"           \
+        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>\n"         \
+        "  </method>\n"                                                 \
+        "  <method name=\"ClearJobs\"/>\n"                              \
+        "  <method name=\"ListUnits\">\n"                               \
+        "   <arg name=\"units\" type=\"a(sssssouso)\" direction=\"out\"/>\n" \
+        "  </method>\n"                                                 \
+        "  <method name=\"ListJobs\">\n"                                \
+        "   <arg name=\"jobs\" type=\"a(usssoo)\" direction=\"out\"/>\n" \
+        "  </method>\n"                                                 \
+        "  <method name=\"Subscribe\"/>\n"                              \
+        "  <method name=\"Unsubscribe\"/>\n"                            \
+        "  <method name=\"Dump\"/>\n"                                   \
+        "  <method name=\"CreateSnapshot\">\n"                          \
+        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg nane=\"cleanup\" type=\"b\" direction=\"in\"/>\n"      \
+        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>\n"        \
+        "  </method>\n"                                                 \
+        "  <method name=\"Reload\"/>\n"                                 \
+        "  <method name=\"Reexecute\"/>\n"                              \
+        "  <method name=\"Exit\"/>\n"                                   \
+        "  <method name=\"SetEnvironment\">\n"                          \
+        "   <arg name=\"names\" type=\"as\" direction=\"in\"/>\n"       \
+        "  </method>\n"                                                 \
+        "  <method name=\"UnsetEnvironment\">\n"                        \
+        "   <arg name=\"names\" type=\"as\" direction=\"in\"/>\n"       \
+        "  </method>\n"                                                 \
+        "  <signal name=\"UnitNew\">\n"                                 \
+        "   <arg name=\"id\" type=\"s\"/>\n"                            \
+        "   <arg name=\"unit\" type=\"o\"/>\n"                          \
+        "  </signal>\n"                                                 \
+        "  <signal name=\"UnitRemoved\">\n"                             \
+        "   <arg name=\"id\" type=\"s\"/>\n"                            \
+        "   <arg name=\"unit\" type=\"o\"/>\n"                          \
+        "  </signal>\n"                                                 \
+        "  <signal name=\"JobNew\">\n"                                  \
+        "   <arg name=\"id\" type=\"u\"/>\n"                            \
+        "   <arg name=\"job\" type=\"o\"/>\n"                           \
+        "  </signal>\n"                                                 \
+        "  <signal name=\"JobRemoved\">\n"                              \
+        "   <arg name=\"id\" type=\"u\"/>\n"                            \
+        "   <arg name=\"job\" type=\"o\"/>\n"                           \
+        "   <arg name=\"success\" type=\"b\"/>\n"                       \
+        "  </signal>"                                                   \
+        "  <property name=\"Version\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"RunningAs\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"BootTimestamp\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"LogLevel\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"LogTarget\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"NNames\" type=\"u\" access=\"read\"/>\n"    \
+        "  <property name=\"NJobs\" type=\"u\" access=\"read\"/>\n"     \
+        "  <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \
+        " </interface>\n"
+
 #define INTROSPECTION_BEGIN                                             \
         DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
-        "<node>"                                                        \
-        " <interface name=\"org.freedesktop.systemd1.Manager\">"        \
-        "  <method name=\"GetUnit\">"                                   \
-        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>"          \
-        "  </method>"                                                   \
-        "  <method name=\"LoadUnit\">"                                  \
-        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>"          \
-        "  </method>"                                                   \
-        "  <method name=\"GetJob\">"                                    \
-        "   <arg name=\"id\" type=\"u\" direction=\"in\"/>"             \
-        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>"           \
-        "  </method>"                                                   \
-        "  <method name=\"ClearJobs\"/>"                                \
-        "  <method name=\"ListUnits\">"                                 \
-        "   <arg name=\"units\" type=\"a(sssssouso)\" direction=\"out\"/>" \
-        "  </method>"                                                   \
-        "  <method name=\"ListJobs\">"                                  \
-        "   <arg name=\"jobs\" type=\"a(usssoo)\" direction=\"out\"/>"  \
-        "  </method>"                                                   \
-        "  <method name=\"Subscribe\"/>"                                \
-        "  <method name=\"Unsubscribe\"/>"                              \
-        "  <method name=\"Dump\"/>"                                     \
-        "  <method name=\"CreateSnapshot\">"                            \
-        "   <arg name=\"name\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg nane=\"cleanup\" type=\"b\" direction=\"in\"/>"        \
-        "   <arg name=\"unit\" type=\"o\" direction=\"out\"/>"          \
-        "  </method>"                                                   \
-        "  <method name=\"Reload\"/>"                                   \
-        "  <method name=\"Reexecute\"/>"                                \
-        "  <method name=\"Exit\"/>"                                     \
-        "  <method name=\"SetEnvironment\">"                            \
-        "   <arg name=\"names\" type=\"as\" direction=\"in\"/>"         \
-        "  </method>"                                                   \
-        "  <method name=\"UnsetEnvironment\">"                          \
-        "   <arg name=\"names\" type=\"as\" direction=\"in\"/>"         \
-        "  </method>"                                                   \
-        "  <signal name=\"UnitNew\">"                                   \
-        "   <arg name=\"id\" type=\"s\"/>"                              \
-        "   <arg name=\"unit\" type=\"o\"/>"                            \
-        "  </signal>"                                                   \
-        "  <signal name=\"UnitRemoved\">"                               \
-        "   <arg name=\"id\" type=\"s\"/>"                              \
-        "   <arg name=\"unit\" type=\"o\"/>"                            \
-        "  </signal>"                                                   \
-        "  <signal name=\"JobNew\">"                                    \
-        "   <arg name=\"id\" type=\"u\"/>"                              \
-        "   <arg name=\"job\" type=\"o\"/>"                             \
-        "  </signal>"                                                   \
-        "  <signal name=\"JobRemoved\">"                                \
-        "   <arg name=\"id\" type=\"u\"/>"                              \
-        "   <arg name=\"job\" type=\"o\"/>"                             \
-        "   <arg name=\"success\" type=\"b\"/>"                         \
-        "  </signal>"                                                   \
-        "  <property name=\"Version\" type=\"s\" access=\"read\"/>"     \
-        "  <property name=\"RunningAs\" type=\"s\" access=\"read\"/>"   \
-        "  <property name=\"BootTimestamp\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"LogLevel\" type=\"s\" access=\"read\"/>"    \
-        "  <property name=\"LogTarget\" type=\"s\" access=\"read\"/>"   \
-        "  <property name=\"NNames\" type=\"u\" access=\"read\"/>"      \
-        "  <property name=\"NJobs\" type=\"u\" access=\"read\"/>"       \
-        "  <property name=\"Environment\" type=\"as\" access=\"read\"/>" \
-        " </interface>"                                                 \
+        "<node>\n"                                                      \
+        BUS_MANAGER_INTERFACE                                           \
         BUS_PROPERTIES_INTERFACE                                        \
         BUS_INTROSPECTABLE_INTERFACE
 
 #define INTROSPECTION_END                                               \
-        "</node>"
+        "</node>\n"
+
+const char bus_manager_interface[] = BUS_MANAGER_INTERFACE;
 
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs);
 
index 0acd2d086d058fa593cd7d882df82b1b8972a1c6..996b680e3c2e816430773294863ae3e28cb93a1a 100644 (file)
@@ -26,4 +26,6 @@
 
 extern const DBusObjectPathVTable bus_manager_vtable;
 
+extern const char bus_manager_interface[];
+
 #endif
index 500b773bf6b504840040838b761831db2daeca66..cccfa60e1092132745973993222593a2e93c001c 100644 (file)
 #include "dbus-mount.h"
 #include "dbus-execute.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Mount\">"
-        "  <property name=\"Where\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"What\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"Options\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"Type\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>"
-        BUS_EXEC_CONTEXT_INTERFACE
-        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_MOUNT_INTERFACE                                             \
+        " <interface name=\"org.freedesktop.systemd1.Mount\">\n"        \
+        "  <property name=\"Where\" type=\"s\" access=\"read\"/>\n"     \
+        "  <property name=\"What\" type=\"s\" access=\"read\"/>\n"      \
+        "  <property name=\"Options\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"Type\" type=\"s\" access=\"read\"/>\n"      \
+        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \
+        BUS_EXEC_CONTEXT_INTERFACE                                      \
+        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_MOUNT_INTERFACE                                             \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_mount_interface[] = BUS_MOUNT_INTERFACE;
 
 static int bus_mount_append_what(Manager *n, DBusMessageIter *i, const char *property, void *data) {
         Mount *m = data;
@@ -130,5 +135,5 @@ DBusHandlerResult bus_mount_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index b92867df2888ed51bd8894a65ad8dbc33adea3d4..6d8d1a9685aba2beff0264dcb1230e6944a6b32b 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_mount_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_mount_interface[];
+
 #endif
index 24dd6c14f6435affc278b5a79e4574e48a45c6c2..6286172a1bc6f26f20044ab47c87369b460e80b1 100644 (file)
 #include "dbus-execute.h"
 #include "dbus-service.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Service\">"
-        "  <property name=\"Type\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"Restart\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"PIDFile\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"RestartUSec\" type=\"t\" access=\"read\"/>"
-        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>"
-        BUS_EXEC_CONTEXT_INTERFACE
-        "  <property name=\"PermissionsStartOnly\" type=\"b\" access=\"read\"/>"
-        "  <property name=\"RootDirectoryStartOnly\" type=\"b\" access=\"read\"/>"
-        "  <property name=\"ValidNoProcess\" type=\"b\" access=\"read\"/>"
-        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"MainPID\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"SysVPath\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"BusName\" type=\"s\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_SERVICE_INTERFACE                                           \
+        " <interface name=\"org.freedesktop.systemd1.Service\">\n"      \
+        "  <property name=\"Type\" type=\"s\" access=\"read\"/>\n"      \
+        "  <property name=\"Restart\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"PIDFile\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"RestartUSec\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \
+        BUS_EXEC_CONTEXT_INTERFACE                                      \
+        "  <property name=\"PermissionsStartOnly\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"RootDirectoryStartOnly\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"ValidNoProcess\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"MainPID\" type=\"u\" access=\"read\"/>\n"   \
+        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
+        "  <property name=\"SysVPath\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"BusName\" type=\"s\" access=\"read\"/>\n"   \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_SERVICE_INTERFACE                                           \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_service_interface[] = BUS_SERVICE_INTERFACE;
 
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_type, service_type, ServiceType);
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_restart, service_restart, ServiceRestart);
@@ -74,5 +79,5 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index f0a468e90d92341daea2baeca3d1446d923e0dea..ab1e02f35207994ca0cc710f5fca9b75dda9fd46 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_service_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_service_interface[];
+
 #endif
index 8aeca15254e0870b7d22e54bdb9debba6aae05ea..15e51f032e63fbc11391ddfd6a4a721191fdfd94 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-snapshot.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Snapshot\">"
-        "  <method name=\"Remove\"/>"
-        "  <property name=\"Cleanup\" type=\"b\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_SNAPSHOT_INTERFACE                                          \
+        " <interface name=\"org.freedesktop.systemd1.Snapshot\">\n"     \
+        "  <method name=\"Remove\"/>\n"                                 \
+        "  <property name=\"Cleanup\" type=\"b\" access=\"read\"/>\n"   \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_SNAPSHOT_INTERFACE                                          \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_snapshot_interface[] = BUS_SNAPSHOT_INTERFACE;
 
 DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message) {
         const BusProperty properties[] = {
@@ -54,7 +59,7 @@ 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(u->meta.manager, message, INTROSPECTION, properties);
 
         if (reply) {
                 if (!dbus_connection_send(u->meta.manager->api_bus, reply, NULL))
index 5f28550c95ffb36d06bf3af1d381c9bfd9b22082..bf5a4d4bc534290043cc94aae9a4dfb3f9e5ee4a 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_snapshot_interface[];
+
 #endif
index cb244a900349dba41d9cfbbdd5c99f674dd705a4..426af2b4cf77f161da4d4efd0d23c2a54b13420d 100644 (file)
 #include "dbus-socket.h"
 #include "dbus-execute.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Socket\">"
-        "  <property name=\"BindIPv6Only\" type=\"b\" access=\"read\"/>"
-        "  <property name=\"Backlog\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>"
-        BUS_EXEC_CONTEXT_INTERFACE
-        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"BindToDevice\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"SocketMode\" type=\"u\" access=\"read\"/>"
-        "  <property name=\"Accept\" type=\"b\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_SOCKET_INTERFACE                                            \
+        " <interface name=\"org.freedesktop.systemd1.Socket\">\n"       \
+        "  <property name=\"BindIPv6Only\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"Backlog\" type=\"u\" access=\"read\"/>\n"   \
+        "  <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>\n" \
+        BUS_EXEC_CONTEXT_INTERFACE                                      \
+        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
+        "  <property name=\"BindToDevice\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>\n" \
+        "  <property name=\"SocketMode\" type=\"u\" access=\"read\"/>\n" \
+        "  <property name=\"Accept\" type=\"b\" access=\"read\"/>\n"    \
+        " </interface>\n"                                               \
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_SOCKET_INTERFACE                                            \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_socket_interface[] = BUS_SOCKET_INTERFACE;
 
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_socket_append_bind_ipv6_only, socket_address_bind_ipv6_only, SocketAddressBindIPv6Only);
 
@@ -64,5 +69,5 @@ DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index 6a8f534bf58e0b42d12b9bf7fe22c6062260c044..ab0632204225e47fc2e2cf1d81d8e8f71454ecfb 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_socket_interface[];
+
 #endif
index e935e09bf212a1e336441e930fe3b3e997f3b67c..f6f8685dafe57c0f24a7ddc0dcd19a197bd17ac4 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-swap.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Swap\">"
-        "  <property name=\"What\" type=\"s\" access=\"read\"/>"
-        "  <property name=\"Priority\" type=\"i\" access=\"read\"/>"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_SWAP_INTERFACE                                              \
+        " <interface name=\"org.freedesktop.systemd1.Swap\">\n"         \
+        "  <property name=\"What\" type=\"s\" access=\"read\"/>\n"      \
+        "  <property name=\"Priority\" type=\"i\" access=\"read\"/>\n"  \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_SWAP_INTERFACE                                              \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_swap_interface[] = BUS_SWAP_INTERFACE;
 
 static int bus_swap_append_priority(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         Swap *s = data;
@@ -69,5 +74,5 @@ DBusHandlerResult bus_swap_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index 3bef6ad621baac7bf95700b5b3bfc2bfed7e5aee..cbd15919db51ea473a3505b39ec847808539989e 100644 (file)
@@ -29,4 +29,6 @@
 
 DBusHandlerResult bus_swap_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_swap_interface[];
+
 #endif
index be984b9bb47faada58fff0bf7bc5ae02b21e368d..45f0d31f05de9efe4a4ec13cb32d35a1b67fb2cc 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-target.h"
 
-static const char introspection[] =
-        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
-        "<node>"
-        BUS_UNIT_INTERFACE
-        BUS_PROPERTIES_INTERFACE
-        " <interface name=\"org.freedesktop.systemd1.Target\">"
-        " </interface>"
-        BUS_INTROSPECTABLE_INTERFACE
-        "</node>";
+#define BUS_TARGET_INTERFACE                                            \
+        " <interface name=\"org.freedesktop.systemd1.Target\">\n"       \
+        " </interface>\n"
+
+#define INTROSPECTION                                                   \
+        DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
+        "<node>\n"                                                      \
+        BUS_UNIT_INTERFACE                                              \
+        BUS_TARGET_INTERFACE                                            \
+        BUS_PROPERTIES_INTERFACE                                        \
+        BUS_INTROSPECTABLE_INTERFACE                                    \
+        "</node>\n"
+
+const char bus_target_interface[] = BUS_TARGET_INTERFACE;
 
 DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message) {
         const BusProperty properties[] = {
@@ -38,5 +43,5 @@ DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message) {
                 { NULL, NULL, NULL, NULL, NULL }
         };
 
-        return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+        return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
 }
index f6a1ac5e65d8cdc934a8988e2f267ab2fbc64fe2..d118441a676c290a3b3ae1423625b092781cc9db 100644 (file)
@@ -28,4 +28,6 @@
 
 DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message);
 
+extern const char bus_target_interface[];
+
 #endif
index ba428a8d5c707515769ab0318e7ff07735cbf30e..87218cd2ee37a7b26860b68e9bd8f569d023099d 100644 (file)
@@ -25,6 +25,8 @@
 #include "log.h"
 #include "dbus-unit.h"
 
+const char bus_unit_interface[] = BUS_UNIT_INTERFACE;
+
 int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         char *t;
         Iterator j;
index c5840d56327d17d13877179daec365acc09ee05b..07641ee951676b289339aa511937330252853329 100644 (file)
 #include "manager.h"
 
 #define BUS_UNIT_INTERFACE \
-        " <interface name=\"org.freedesktop.systemd1.Unit\">"           \
-        "  <method name=\"Start\">"                                     \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>"           \
-        "  </method>"                                                   \
-        "  <method name=\"Stop\">"                                      \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>"           \
-        "  </method>"                                                   \
-        "  <method name=\"Restart\">"                                   \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>"           \
-        "  </method>"                                                   \
-        "  <method name=\"Reload\">"                                    \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>"           \
-        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>"           \
-        "  </method>"                                                   \
-        "  <signal name=\"Changed\"/>"                                  \
-        "  <property name=\"Id\" type=\"s\" access=\"read\"/>"          \
-        "  <property name=\"Names\" type=\"as\" access=\"read\"/>"      \
-        "  <property name=\"Requires\" type=\"as\" access=\"read\"/>"   \
-        "  <property name=\"RequiresOverridable\" type=\"as\" access=\"read\"/>" \
-        "  <property name=\"Requisite\" type=\"as\" access=\"read\"/> \
-        "  <property name=\"RequisiteOverridable\" type=\"as\" access=\"read\"/>" \
-        "  <property name=\"Wants\" type=\"as\" access=\"read\"/>"      \
-        "  <property name=\"RequiredBy\" type=\"as\" access=\"read\"/>" \
-        "  <property name=\"RequiredByOverridable\" type=\"as\" access=\"read\"/>" \
-        "  <property name=\"WantedBy\" type=\"as\" access=\"read\"/>"   \
-        "  <property name=\"Conflicts\" type=\"as\" access=\"read\"/> \
-        "  <property name=\"Before\" type=\"as\" access=\"read\"/>"     \
-        "  <property name=\"After\" type=\"as\" access=\"read\"/>"      \
-        "  <property name=\"Description\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"LoadState\" type=\"s\" access=\"read\"/>"   \
-        "  <property name=\"ActiveState\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"SubState\" type=\"s\" access=\"read\"/>"    \
-        "  <property name=\"FragmentPath\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"InactiveExitTimestamp\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"ActiveEnterTimestamp\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"ActiveExitTimestamp\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"InactiveEnterTimestamp\" type=\"t\" access=\"read\"/>" \
-        "  <property name=\"CanReload\" type=\"b\" access=\"read\"/>"   \
-        "  <property name=\"CanStart\" type=\"b\" access=\"read\"/>"    \
-        "  <property name=\"Job\" type=\"(uo)\" access=\"read\"/>"      \
-        "  <property name=\"RecursiveStop\" type=\"b\" access=\"read\"/>" \
-        "  <property name=\"StopWhenUneeded\" type=\"b\" access=\"read\"/>" \
-        "  <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>" \
-        "  <property name=\"ControlGroups\" type=\"as\" access=\"read\"/>" \
-        " </interface>"
+        " <interface name=\"org.freedesktop.systemd1.Unit\">\n"         \
+        "  <method name=\"Start\">\n"                                   \
+        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>\n"         \
+        "  </method>\n"                                                 \
+        "  <method name=\"Stop\">\n"                                    \
+        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>\n"         \
+        "  </method>\n"                                                 \
+        "  <method name=\"Restart\">\n"                                 \
+        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>\n"         \
+        "  </method>\n"                                                 \
+        "  <method name=\"Reload\">\n"                                  \
+        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
+        "   <arg name=\"job\" type=\"o\" direction=\"out\"/>\n"         \
+        "  </method>\n"                                                 \
+        "  <signal name=\"Changed\"/>\n"                                \
+        "  <property name=\"Id\" type=\"s\" access=\"read\"/>\n"        \
+        "  <property name=\"Names\" type=\"as\" access=\"read\"/>\n"    \
+        "  <property name=\"Requires\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"RequiresOverridable\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"Requisite\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"RequisiteOverridable\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"Wants\" type=\"as\" access=\"read\"/>\n"    \
+        "  <property name=\"RequiredBy\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"RequiredByOverridable\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"WantedBy\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"Conflicts\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"Before\" type=\"as\" access=\"read\"/>\n"   \
+        "  <property name=\"After\" type=\"as\" access=\"read\"/>\n"    \
+        "  <property name=\"Description\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"LoadState\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"ActiveState\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"SubState\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"FragmentPath\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"InactiveExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"ActiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"ActiveExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"InactiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
+        "  <property name=\"CanReload\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"CanStart\" type=\"b\" access=\"read\"/>\n"  \
+        "  <property name=\"Job\" type=\"(uo)\" access=\"read\"/>\n"    \
+        "  <property name=\"RecursiveStop\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"StopWhenUneeded\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"ControlGroups\" type=\"as\" access=\"read\"/>\n" \
+        " </interface>\n"
 
 #define BUS_UNIT_PROPERTIES \
         { "org.freedesktop.systemd1.Unit", "Id",                   bus_property_append_string,     "s",    u->meta.id                        }, \
@@ -125,4 +125,6 @@ void bus_unit_send_removed_signal(Unit *u);
 
 extern const DBusObjectPathVTable bus_unit_vtable;
 
+extern const char bus_unit_interface[];
+
 #endif
index 6ed659a2393e870786035e71f22b05b193f85c36..5caf1eb19176dfafd579986ec1cc085f56561b56 100644 (file)
 #include "dbus-unit.h"
 #include "dbus-job.h"
 #include "dbus-manager.h"
+#include "dbus-service.h"
+#include "dbus-socket.h"
+#include "dbus-target.h"
+#include "dbus-device.h"
+#include "dbus-mount.h"
+#include "dbus-automount.h"
+#include "dbus-snapshot.h"
+#include "dbus-swap.h"
+
+static const char bus_properties_interface[] = BUS_PROPERTIES_INTERFACE;
+static const char bus_introspectable_interface[] = BUS_INTROSPECTABLE_INTERFACE;
+
+const char *const bus_interface_table[] = {
+        "org.freedesktop.DBus.Properties",     bus_properties_interface,
+        "org.freedesktop.DBus.Introspectable", bus_introspectable_interface,
+        "org.freedesktop.systemd1.Manager",    bus_manager_interface,
+        "org.freedesktop.systemd1.Job",        bus_job_interface,
+        "org.freedesktop.systemd1.Unit",       bus_unit_interface,
+        "org.freedesktop.systemd1.Service",    bus_service_interface,
+        "org.freedesktop.systemd1.Socket",     bus_socket_interface,
+        "org.freedesktop.systemd1.Target",     bus_target_interface,
+        "org.freedesktop.systemd1.Device",     bus_device_interface,
+        "org.freedesktop.systemd1.Mount",      bus_mount_interface,
+        "org.freedesktop.systemd1.Automount",  bus_automount_interface,
+        "org.freedesktop.systemd1.Snapshot",   bus_snapshot_interface,
+        "org.freedesktop.systemd1.Swap",       bus_swap_interface,
+        NULL
+};
 
 static void api_bus_dispatch_status(DBusConnection *bus, DBusDispatchStatus status, void *data)  {
         Manager *m = data;
index 51b71eac6103d3913d645e6edb0129bac6a2f473..3ad299ed38d89640ef6ba6adc1bc6ac7266ba3c5 100644 (file)
@@ -37,24 +37,24 @@ typedef struct BusProperty {
 } BusProperty;
 
 #define BUS_PROPERTIES_INTERFACE                                        \
-        " <interface name=\"org.freedesktop.DBus.Properties\">"         \
-        "  <method name=\"Get\">"                                       \
-        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"      \
-        "   <arg name=\"property\" direction=\"in\" type=\"s\"/>"       \
-        "   <arg name=\"value\" direction=\"out\" type=\"v\"/>"         \
-        "  </method>"                                                   \
-        "  <method name=\"GetAll\">"                                    \
-        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"      \
-        "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \
-        "  </method>"                                                   \
-        " </interface>"
+        " <interface name=\"org.freedesktop.DBus.Properties\">\n"         \
+        "  <method name=\"Get\">\n"                                       \
+        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"      \
+        "   <arg name=\"property\" direction=\"in\" type=\"s\"/>\n"       \
+        "   <arg name=\"value\" direction=\"out\" type=\"v\"/>\n"         \
+        "  </method>\n"                                                   \
+        "  <method name=\"GetAll\">\n"                                    \
+        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"      \
+        "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" \
+        "  </method>\n"                                                   \
+        " </interface>\n"
 
 #define BUS_INTROSPECTABLE_INTERFACE                                    \
-        " <interface name=\"org.freedesktop.DBus.Introspectable\">"     \
-        "  <method name=\"Introspect\">"                                \
-        "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"          \
-        "  </method>"                                                   \
-        " </interface>"
+        " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"     \
+        "  <method name=\"Introspect\">\n"                                \
+        "   <arg name=\"data\" type=\"s\" direction=\"out\"/>\n"          \
+        "  </method>\n"                                                   \
+        " </interface>\n"
 
 int bus_init_system(Manager *m);
 int bus_init_api(Manager *m);
@@ -104,4 +104,6 @@ int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *prope
 
 int bus_parse_strv(DBusMessage *m, char ***_l);
 
+extern const char * const bus_interface_table[];
+
 #endif
index 3b9719fb568d45013da523a42d2d90e2cf8108d3..d7d3995e1b13a4f4b7cf8cdf3f48828332dc3d13 100644 (file)
@@ -45,7 +45,8 @@ static enum {
         ACTION_RUN,
         ACTION_HELP,
         ACTION_TEST,
-        ACTION_DUMP_CONFIGURATION_ITEMS
+        ACTION_DUMP_CONFIGURATION_ITEMS,
+        ACTION_DONE
 } action = ACTION_RUN;
 
 static char *default_unit = NULL;
@@ -347,7 +348,8 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_TEST,
                 ARG_DUMP_CONFIGURATION_ITEMS,
                 ARG_CONFIRM_SPAWN,
-                ARG_DESERIALIZE
+                ARG_DESERIALIZE,
+                ARG_INTROSPECT
         };
 
         static const struct option options[] = {
@@ -360,6 +362,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "dump-configuration-items", no_argument,       NULL, ARG_DUMP_CONFIGURATION_ITEMS },
                 { "confirm-spawn",            no_argument,       NULL, ARG_CONFIRM_SPAWN            },
                 { "deserialize",              required_argument, NULL, ARG_DESERIALIZE              },
+                { "introspect",               optional_argument, NULL, ARG_INTROSPECT               },
                 { NULL,                       0,                 NULL, 0                            }
         };
 
@@ -444,6 +447,27 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
                 }
 
+                case ARG_INTROSPECT: {
+                        const char * const * i = NULL;
+
+                        for (i = bus_interface_table; *i; i += 2)
+                                if (!optarg || streq(i[0], optarg)) {
+                                        fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
+                                              "<node>\n", stdout);
+                                        fputs(i[1], stdout);
+                                        fputs("</node>\n", stdout);
+
+                                        if (optarg)
+                                                break;
+                                }
+
+                        if (!i[0] && optarg)
+                                log_error("Unknown interface %s.", optarg);
+
+                        action = ACTION_DONE;
+                        break;
+                }
+
                 case 'h':
                         action = ACTION_HELP;
                         break;
@@ -478,7 +502,8 @@ static int help(void) {
                "     --running-as=AS             Set running as (init, system, session)\n"
                "     --test                      Determine startup sequence, dump it and exit\n"
                "     --dump-configuration-items  Dump understood unit configuration items\n"
-               "     --confirm-spawn             Ask for confirmation when spawning processes\n",
+               "     --confirm-spawn             Ask for confirmation when spawning processes\n"
+               "     --introspect[=INTERFACE]    Extract D-Bus interface data\n",
                __progname);
 
         return 0;
@@ -582,6 +607,9 @@ int main(int argc, char *argv[]) {
                 unit_dump_config_items(stdout);
                 retval = 0;
                 goto finish;
+        } else if (action == ACTION_DONE) {
+                retval = 0;
+                goto finish;
         }
 
         assert_se(action == ACTION_RUN || action == ACTION_TEST);