[systemd-devel] [RFC] bus: add sd_bus_emit_object_{added, removed}()

Lennart Poettering lennart at poettering.net
Tue Mar 11 11:27:30 PDT 2014


On Tue, 18.02.14 00:02, David Herrmann (dh.herrmann at gmail.com) wrote:

Sorry for the late review!

> 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?

I would assume that it is OK to assume that. People should call this
function before half-destroying their object. I mean we are not reading
the properties after all, just the interfaces and I think that should be
quite OK to require.

Certainly something to document though one day...

> +static int object_added_append_all_prefix(
> +                sd_bus *bus,
> +                sd_bus_message *m,
> +                Set *s,
> +                const char *prefix,
> +                const char *path,
> +                bool require_fallback) {
> +

> +                if (!streq_ptr(c->interface, previous_interface)) {
> +                        /* interface already handled by a previous run? */
> +                        if (set_get(s, c->interface))
> +                                continue;

We actually allow multiple vtables with the same interface, and order
them together in the vtable list, so that we can iterate through them
easily with trivial duplicate reduction. Keeping a Set object here
appears unnecessary? Or did I miss something here?

Otherwise looks good!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list