[systemd-devel] [RFC] bus: add sd_bus_emit_object_{added, removed}()
David Herrmann
dh.herrmann at gmail.com
Tue Dec 30 02:45:28 PST 2014
Hi
On Tue, Feb 18, 2014 at 12:02 AM, David Herrmann <dh.herrmann at gmail.com> wrote:
> The ObjectManager dbus interface provides an InterfacesAdded signal to
> notify others about new interfaces that are added to an object. The same
> signal is also used to advertise new objects (by adding the first
> interface to a given object path) and delete them.
>
> However, our internal helpers sd_bus_emit_interfaces_{added,removed}()
> cannot properly deal with built-in interfaces like DBus.Properties as
> there's no vtable for it. Therefore, to avoid callers to track these
> internal interfaces, we provide two separate helpers which explicitly add
> these interfaces to the signal.
>
> sd_bus_emit_object_added() traverses the list of all vtables and fallback
> vtables (making sure a fallback never overwrites a real vtable!) and also
> adds built-in interfaces.
>
> sd_bus_emit_object_removed(): WIP
> ---
> Hi
>
> This is untested and I just wanted to get some feedback whether that's the way
> to go. Given the previous discussion we decided on two new entry-points to add
> and remove objects. For convenience, I now tried to omit any "char **interfaces"
> argument to object_added() and just try to figure them out on my own.
>
> However, on object_removed() I cannot do that as node_vtable_get_userdata() is
> very likely to return "0" for all these objects. So there is no way to figure
> out which interfaces actually existed on that thing. We would require users to
> call it *before* destroying/unlinking the actual object. I don't know whether
> that's ok to assume?
>
> If not, we can just add a "char **interfaces" argument, but then it would differ
> from object_added().. Not sure what sounds better..
>
> Cheers
> David
>
> src/libsystemd/sd-bus/bus-objects.c | 210 ++++++++++++++++++++++++++++++++++++
> src/systemd/sd-bus.h | 2 +
> 2 files changed, 212 insertions(+)
After almost 1 year of niche existence I finally went ahead and
re-implemented this. Review is welcome!
Pushed.
Thanks
David
More information about the systemd-devel
mailing list