chiark / gitweb /
bus: introduce new SD_BUS_VTABLE_HIDDEN flag for vtable members
authorLennart Poettering <lennart@poettering.net>
Tue, 10 Dec 2013 16:49:00 +0000 (16:49 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Dec 2013 16:52:49 +0000 (16:52 +0000)
When this flag is set then its member will not be shown in the
introspection data. Also, properties with this flag set will not be
included in GetAll() responses.

src/libsystemd-bus/bus-introspect.c
src/libsystemd-bus/bus-objects.c
src/systemd/sd-bus-vtable.h

index 8bec017..504fab1 100644 (file)
@@ -121,6 +121,9 @@ int introspect_write_interface(struct introspect *i, const sd_bus_vtable *v) {
 
         for (; v->type != _SD_BUS_VTABLE_END; v++) {
 
+                if (v->type != _SD_BUS_VTABLE_START && (v->flags & SD_BUS_VTABLE_HIDDEN))
+                        continue;
+
                 switch (v->type) {
 
                 case _SD_BUS_VTABLE_START:
index 941c281..8ffda2f 100644 (file)
@@ -633,10 +633,16 @@ static int vtable_append_all_properties(
         assert(path);
         assert(c);
 
+        if (c->vtable[0].flags & SD_BUS_VTABLE_HIDDEN)
+                return 1;
+
         for (v = c->vtable+1; v->type != _SD_BUS_VTABLE_END; v++) {
                 if (v->type != _SD_BUS_VTABLE_PROPERTY && v->type != _SD_BUS_VTABLE_WRITABLE_PROPERTY)
                         continue;
 
+                if (v->flags & SD_BUS_VTABLE_HIDDEN)
+                        continue;
+
                 r = sd_bus_message_open_container(reply, 'e', "sv");
                 if (r < 0)
                         return r;
@@ -853,6 +859,9 @@ static int process_introspect(
 
                 empty = false;
 
+                if (c->vtable[0].flags & SD_BUS_VTABLE_HIDDEN)
+                        continue;
+
                 if (!streq_ptr(previous_interface, c->interface)) {
 
                         if (previous_interface)
index e6e0a72..5400e9a 100644 (file)
@@ -46,6 +46,7 @@ enum {
         SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE    = 1ULL << 2,
         SD_BUS_VTABLE_PROPERTY_INVALIDATE_ONLY = 1ULL << 3,
         SD_BUS_VTABLE_UNPRIVILEGED             = 1ULL << 4,
+        SD_BUS_VTABLE_HIDDEN                   = 1ULL << 5,
         _SD_BUS_VTABLE_CAPABILITY_MASK         = 0xFFFFULL << 40
 };