diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-05-15 01:15:30 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-15 01:15:30 +0200 |
commit | 19befb2d5fc087f96e40ddc432b2cc9385666209 (patch) | |
tree | 4a28a54ed25ba8fb57578f639b2691749c9c935e /src/machine | |
parent | 9a78148e40402b44f361f4fbf63bb97a21aeac0b (diff) |
sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and
creates proper object for unregistering callbacks.
Taking the refernce to the slot is optional. If not taken life time of
the slot will be bound to the underlying bus object (or in the case of
an async call until the reply has been recieved).
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machine-dbus.c | 2 | ||||
-rw-r--r-- | src/machine/machined.c | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 920c9956ae..83ef82d2e0 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -160,7 +160,7 @@ int machine_object_find(sd_bus *bus, const char *path, const char *interface, vo sd_bus_message *message; pid_t pid; - message = sd_bus_get_current(bus); + message = sd_bus_get_current_message(bus); if (!message) return 0; diff --git a/src/machine/machined.c b/src/machine/machined.c index 20e6f7cd63..45768d2e97 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -141,25 +141,26 @@ static int manager_connect_bus(Manager *m) { return r; } - r = sd_bus_add_object_vtable(m->bus, "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", manager_vtable, m); + r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", manager_vtable, m); if (r < 0) { log_error("Failed to add manager object vtable: %s", strerror(-r)); return r; } - r = sd_bus_add_fallback_vtable(m->bus, "/org/freedesktop/machine1/machine", "org.freedesktop.machine1.Machine", machine_vtable, machine_object_find, m); + r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/machine1/machine", "org.freedesktop.machine1.Machine", machine_vtable, machine_object_find, m); if (r < 0) { log_error("Failed to add machine object vtable: %s", strerror(-r)); return r; } - r = sd_bus_add_node_enumerator(m->bus, "/org/freedesktop/machine1/machine", machine_node_enumerator, m); + r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/machine1/machine", machine_node_enumerator, m); if (r < 0) { log_error("Failed to add machine enumerator: %s", strerror(-r)); return r; } r = sd_bus_add_match(m->bus, + NULL, "type='signal'," "sender='org.freedesktop.systemd1'," "interface='org.freedesktop.systemd1.Manager'," @@ -173,6 +174,7 @@ static int manager_connect_bus(Manager *m) { } r = sd_bus_add_match(m->bus, + NULL, "type='signal'," "sender='org.freedesktop.systemd1'," "interface='org.freedesktop.systemd1.Manager'," @@ -186,6 +188,7 @@ static int manager_connect_bus(Manager *m) { } r = sd_bus_add_match(m->bus, + NULL, "type='signal'," "sender='org.freedesktop.systemd1'," "interface='org.freedesktop.DBus.Properties'," @@ -198,6 +201,7 @@ static int manager_connect_bus(Manager *m) { } r = sd_bus_add_match(m->bus, + NULL, "type='signal'," "sender='org.freedesktop.systemd1'," "interface='org.freedesktop.systemd1.Manager'," |