Пример #1
0
static int enumerator_callback(sd_bus *b, const char *path, char ***nodes, void *userdata) {

        if (object_path_startswith("/value", path))
                assert_se(*nodes = strv_new("/value/a", "/value/b", "/value/c", NULL));

        return 1;
}
Пример #2
0
static int enumerator2_callback(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) {

        if (object_path_startswith("/value/a", path))
                assert_se(*nodes = strv_new("/value/a/x", "/value/a/y", "/value/a/z", NULL));

        return 1;
}
Пример #3
0
int introspect_write_child_nodes(struct introspect *i, Set *s, const char *prefix) {
        char *node;

        assert(i);
        assert(prefix);

        while ((node = set_steal_first(s))) {
                const char *e;

                e = object_path_startswith(node, prefix);
                if (e && e[0])
                        fprintf(i->f, " <node name=\"%s\"/>\n", e);

                free(node);
        }

        return 0;
}